diff options
| author | Matthew Hall <hallmatthew314@gmail.com> | 2023-03-26 15:37:26 +1300 |
|---|---|---|
| committer | Matthew Hall <hallmatthew314@gmail.com> | 2023-03-26 15:37:26 +1300 |
| commit | f156d80cc3c80385456bc3ec80adb5ad892f5039 (patch) | |
| tree | b0f651e9c5c2dee779e941ac9d1eb9a20ddaabb7 /spec | |
| parent | ed57fac2de48c7a86536ae22c77540f787d49a81 (diff) | |
Implement map_const
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/parcom_spec.cr | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/parcom_spec.cr b/spec/parcom_spec.cr index efb3964..cee6ff4 100644 --- a/spec/parcom_spec.cr +++ b/spec/parcom_spec.cr @@ -278,6 +278,18 @@ describe Parser do end end + describe "#map_const" do + p = Parser(Char, Char).any_token + p_mapped = p.map_const(42) + + tokens = Tokens.from_string("abcd") + result = p_mapped.parse(tokens) + + it "changes the value of the result" do + result.value.should eq(42) + end + end + describe "#|" do a = Parser(Char, Char).token('a') b = Parser(Char, Char).token('b') |
