Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | |
| 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.md file. | |
| 4 | |
| 5 import 'dart:io'; | |
| 6 | |
| 7 import 'package:expect/expect.dart'; | |
| 8 | |
| 9 import '../json.dart'; | |
| 10 | |
| 11 void main() { | |
| 12 testParser(); | |
| 13 } | |
| 14 | |
| 15 void testParser() { | |
| 16 Expect.equals(null, new JsonParser('null').parse()); | |
| 17 Expect.equals(true, new JsonParser('true').parse()); | |
| 18 Expect.equals(false, new JsonParser('false').parse()); | |
| 19 Expect.equals(42, new JsonParser('42').parse()); | |
| 20 Expect.equals("hello world", new JsonParser('"hello world"').parse()); | |
| 21 | |
| 22 Expect.listEquals( | |
| 23 [true, "hello world", 42], | |
| 24 new JsonParser('[true,"hello world",42]').parse()); | |
| 25 | |
| 26 Expect.listEquals( | |
| 27 [true, "hello world", 42], | |
| 28 new JsonParser(' [ true , "hello world" , 42 ] ').parse()); | |
| 29 | |
| 30 Expect.mapEquals( | |
| 31 {"foo":true, "bar":"hello world", "baz":42}, | |
| 32 new JsonParser('{"foo":true,"bar":"hello world","baz":42}').parse()); | |
| 33 | |
| 34 Expect.mapEquals( | |
| 35 {"foo":true, "bar":"hello world", "baz":42}, | |
| 36 new JsonParser(' { "foo" :\t true , "bar" : "hello world" , "baz" : 42 } ') | |
| 37 .parse()); | |
|
Anders Johnsen
2015/03/05 07:35:31
Expect.throws(() => new JsonParser('[1 2 3 4 5]').
zerny-google
2015/03/05 08:12:31
Done.
| |
| 38 } | |
| OLD | NEW |