OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/json.h" | 6 #include "platform/json.h" |
7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
8 | 8 |
9 namespace dart { | 9 namespace dart { |
10 | 10 |
11 | 11 |
12 TEST_CASE(JSON_ScanJSON) { | 12 TEST_CASE(JSON_ScanJSON) { |
13 const char* msg = "{ \"id\": 5, \"command\" : \"Debugger.pause\" }"; | 13 const char* msg = "{ \"id\": 5, \"command\" : \"Debugger.pause\" }"; |
14 | 14 |
15 JSONScanner scanner(msg); | 15 JSONScanner scanner(msg); |
16 EXPECT_EQ(scanner.CurrentToken(), JSONScanner::TokenIllegal); | 16 EXPECT_EQ(scanner.CurrentToken(), JSONScanner::TokenIllegal); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 EXPECT_STREQ("{ \"length\" : 175, \"command\" : \"stopIt\" }", w.buf()); | 110 EXPECT_STREQ("{ \"length\" : 175, \"command\" : \"stopIt\" }", w.buf()); |
111 | 111 |
112 JSONReader r(w.buf()); | 112 JSONReader r(w.buf()); |
113 bool found = r.Seek("command"); | 113 bool found = r.Seek("command"); |
114 EXPECT(found); | 114 EXPECT(found); |
115 EXPECT_EQ(r.Type(), JSONReader::kString); | 115 EXPECT_EQ(r.Type(), JSONReader::kString); |
116 EXPECT(r.IsStringLiteral("stopIt")); | 116 EXPECT(r.IsStringLiteral("stopIt")); |
117 } | 117 } |
118 | 118 |
119 } // namespace dart | 119 } // namespace dart |
OLD | NEW |