aboutsummaryrefslogtreecommitdiff
path: root/spec/parcom_spec.cr
diff options
context:
space:
mode:
Diffstat (limited to 'spec/parcom_spec.cr')
-rw-r--r--spec/parcom_spec.cr12
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')