OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:unittest/unittest.dart'; | 5 import 'package:unittest/unittest.dart'; |
6 import 'lax_json.dart'; | 6 import 'lax_json.dart'; |
7 | 7 |
8 void main() { | 8 void main() { |
9 test('primitives', () { | 9 test('primitives', () { |
10 expect(decode('true'), equals(true)); | 10 expect(decode('true'), equals(true)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 expect(decode('["foo", "bar", true, \nnull\n,false,]'), | 44 expect(decode('["foo", "bar", true, \nnull\n,false,]'), |
45 equals(['foo', 'bar', true, null, false])); | 45 equals(['foo', 'bar', true, null, false])); |
46 }); | 46 }); |
47 | 47 |
48 test('map', () { | 48 test('map', () { |
49 expect(decode('{}'), equals({})); | 49 expect(decode('{}'), equals({})); |
50 expect(decode('{\n}'), equals({})); | 50 expect(decode('{\n}'), equals({})); |
51 expect(decode('{"foo":"bar"}'), equals({'foo': 'bar'})); | 51 expect(decode('{"foo":"bar"}'), equals({'foo': 'bar'})); |
52 expect(decode('{"foo":"bar",}'), equals({'foo': 'bar'})); | 52 expect(decode('{"foo":"bar",}'), equals({'foo': 'bar'})); |
53 expect( | 53 expect( |
54 decode( | 54 decode('{"foo":true, "bar": false, "baz": true, ' |
55 '{"foo":true, "bar": false, "baz": true, ' | 55 '"boz": \nnull\n,"qux": false,}'), |
56 '"boz": \nnull\n,"qux": false,}'), | |
57 equals({ | 56 equals({ |
58 'foo': true, | 57 'foo': true, |
59 'bar': false, | 58 'bar': false, |
60 'baz': true, | 59 'baz': true, |
61 'boz': null, | 60 'boz': null, |
62 'qux': false | 61 'qux': false |
63 })); | 62 })); |
64 }); | 63 }); |
65 } | 64 } |
OLD | NEW |