aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/practical/int_int_hash_spec.cr8
1 files changed, 2 insertions, 6 deletions
diff --git a/spec/practical/int_int_hash_spec.cr b/spec/practical/int_int_hash_spec.cr
index 4d4ce0c..d9b256d 100644
--- a/spec/practical/int_int_hash_spec.cr
+++ b/spec/practical/int_int_hash_spec.cr
@@ -3,7 +3,6 @@ require "../spec_helper"
include Parcom
describe "Hash(Int32, Int32) parser", tags: "example" do
- # setup
d = Parser(Char, Char).satisfy(&.number?).named("digit")
abs_num = d.some.map { |ds| ds.join.to_i32 }.named("abs_num")
@@ -12,7 +11,7 @@ describe "Hash(Int32, Int32) parser", tags: "example" do
int32 = parser_chain Char, Int32, "int32",
{s, sign},
{n, abs_num},
- pure: n * s
+ pure: n * s
ws = Parser(Char, Char).satisfy(&.whitespace?)
.many
@@ -28,10 +27,7 @@ describe "Hash(Int32, Int32) parser", tags: "example" do
delim = (ws >> Parser.token(',') >> ws).named("delim")
- elements = parser_chain Char, Array({Int32, Int32}), "elements",
- {pairs, pair.sep_by(delim)},
- {_, delim.optional}, # trailing comma
- pure: pairs
+ elements = (pair.sep_by(delim) << delim.optional).named("elements")
hash_start = (Parser.token('{') >> ws).named("start")
hash_end = (ws >> Parser.token('}')).named("end")