aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hall <hallmatthew314@gmail.com>2023-03-27 23:44:34 +1300
committerMatthew Hall <hallmatthew314@gmail.com>2023-03-27 23:44:34 +1300
commit3d8af6e93dfedcf2fa4e37adbece58dccaba168a (patch)
tree76393c177194bb35c495bed154b32e12755bafb1
parentb6d48036b6ffa643eaaa6ce275e54c44aae342bb (diff)
Finish up JSON parsing example
-rw-r--r--spec/practical/json_spec.cr10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/practical/json_spec.cr b/spec/practical/json_spec.cr
index 7a2875f..79d60dd 100644
--- a/spec/practical/json_spec.cr
+++ b/spec/practical/json_spec.cr
@@ -2,8 +2,6 @@ require "../spec_helper"
include Parcom
-# NOTE: WORK IN PROGRESS
-
alias JSONType = Nil \
| Bool \
| Int64 \
@@ -412,6 +410,14 @@ describe "example: JSON parsing" do
result.tokens.empty?.should be_true
end
end
+
+ it "parses objects" do
+ {"{}", "{\"foo\": 1}"}.each do |s|
+ result = json_value.parse(Tokens.from_string(s))
+ result.value.data.should be_a(Hash(String, JSONValue))
+ result.tokens.empty?.should be_true
+ end
+ end
end
end