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 "platform/text_buffer.h" | 6 #include "platform/text_buffer.h" |
7 #include "vm/json_stream.h" | 7 #include "vm/json_stream.h" |
8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
| 13 #ifndef PRODUCT |
13 | 14 |
14 TEST_CASE(JSON_TextBuffer) { | 15 TEST_CASE(JSON_TextBuffer) { |
15 TextBuffer w(5); // Small enough to make buffer grow at least once. | 16 TextBuffer w(5); // Small enough to make buffer grow at least once. |
16 w.Printf("{ \"%s\" : %d", "length", 175); | 17 w.Printf("{ \"%s\" : %d", "length", 175); |
17 EXPECT_STREQ("{ \"length\" : 175", w.buf()); | 18 EXPECT_STREQ("{ \"length\" : 175", w.buf()); |
18 w.Printf(", \"%s\" : \"%s\" }", "command", "stopIt"); | 19 w.Printf(", \"%s\" : \"%s\" }", "command", "stopIt"); |
19 EXPECT_STREQ("{ \"length\" : 175, \"command\" : \"stopIt\" }", w.buf()); | 20 EXPECT_STREQ("{ \"length\" : 175, \"command\" : \"stopIt\" }", w.buf()); |
20 } | 21 } |
21 | 22 |
22 | 23 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 EXPECT(js.num_params() == 0); | 308 EXPECT(js.num_params() == 0); |
308 js.SetParams(¶m_keys[0], ¶m_values[0], 2); | 309 js.SetParams(¶m_keys[0], ¶m_values[0], 2); |
309 EXPECT(js.num_params() == 2); | 310 EXPECT(js.num_params() == 2); |
310 EXPECT(!js.HasParam("lizard")); | 311 EXPECT(!js.HasParam("lizard")); |
311 EXPECT(js.HasParam("dog")); | 312 EXPECT(js.HasParam("dog")); |
312 EXPECT(js.HasParam("cat")); | 313 EXPECT(js.HasParam("cat")); |
313 EXPECT(js.ParamIs("cat", "banana")); | 314 EXPECT(js.ParamIs("cat", "banana")); |
314 EXPECT(!js.ParamIs("dog", "banana")); | 315 EXPECT(!js.ParamIs("dog", "banana")); |
315 } | 316 } |
316 | 317 |
| 318 #endif // !PRODUCT |
| 319 |
317 } // namespace dart | 320 } // namespace dart |
OLD | NEW |