diff options
author | Florian Frank <flori@ping.de> | 2016-07-07 14:50:01 +0200 |
---|---|---|
committer | Florian Frank <flori@ping.de> | 2016-07-07 14:50:01 +0200 |
commit | d484f402327c9abf26e6b021576872e207132483 (patch) | |
tree | 792de8642712d223553f1391819ca12ee179728e /tests | |
parent | f679ebd0c69a94e3e70a897ac9a229f5779c2ee1 (diff) | |
download | json-d484f402327c9abf26e6b021576872e207132483.tar.gz |
Test parsing some simple singular values
Diffstat (limited to 'tests')
-rw-r--r-- | tests/json_parser_test.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/json_parser_test.rb b/tests/json_parser_test.rb index c1c2779..f34bc02 100644 --- a/tests/json_parser_test.rb +++ b/tests/json_parser_test.rb @@ -40,6 +40,18 @@ class JSONParserTest < Test::Unit::TestCase assert_equal({ 'a' => 'b' }, parser.parse) end + def test_parse_values + assert_equal(nil, parse('null')) + assert_equal(false, parse('false')) + assert_equal(true, parse('true')) + assert_equal(-23, parse('-23')) + assert_equal(23, parse('23')) + assert_in_delta(0.23, parse('0.23'), 1e-2) + assert_in_delta(0.0, parse('0e0'), 1e-2) + assert_equal("", parse('""')) + assert_equal("foobar", parse('"foobar"')) + end + def test_parse_simple_arrays assert_equal([], parse('[]')) assert_equal([], parse(' [ ] ')) @@ -277,7 +289,6 @@ EOT assert_equal data, parse(json) end - class SubArray < Array def <<(v) @shifted = true |