From 8f8bee2893df280bd013e06c338838c758c4d8fc Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Thu, 9 Mar 2023 00:57:22 +1300 Subject: Rewrite Map to use blocks --- spec/parcom_spec.cr | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'spec') diff --git a/spec/parcom_spec.cr b/spec/parcom_spec.cr index 346e61b..bdf8b5b 100644 --- a/spec/parcom_spec.cr +++ b/spec/parcom_spec.cr @@ -163,7 +163,6 @@ end describe Assert do test_f = ->(x : Char) { x == 't' } - #p_proc = Assert.new(AnyToken(Char).new, test_f) p = AnyToken(Char).new.assert { |x| x == 't' } describe "#parse" do @@ -245,15 +244,13 @@ end describe Map do describe "#parse" do it "fails if the wrapped parser fails" do - id = ->(x : Char) { x } - p = Map.new(AnyToken(Char).new, id) + p = AnyToken(Char).new.map { |x| x } expect_raises(ParserException) { p.parse(TokenStream.new([] of Char)) } end it "changes the result value via the provided proc" do - is_letter = ->(x : Char) { x.letter? } - p = Map.new(AnyToken(Char).new, is_letter) + p = AnyToken(Char).new.map { |x| x.letter? } result = p.parse(TokenStream.from_string("testing")) result.value.should be_true -- cgit v1.2.1