| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Note: This test relies on LF line endings in the source file. |
| 6 |
| 5 library json_pretty_test; | 7 library json_pretty_test; |
| 6 | 8 |
| 7 import 'dart:convert'; | 9 import 'dart:convert'; |
| 8 | 10 |
| 9 import "package:expect/expect.dart"; | 11 import "package:expect/expect.dart"; |
| 10 | 12 |
| 11 void _testIndentWithNullChar() { | 13 void _testIndentWithNullChar() { |
| 12 var encoder = const JsonEncoder.withIndent('\x00'); | 14 var encoder = const JsonEncoder.withIndent('\x00'); |
| 13 var encoded = encoder.convert([[],[[]]]); | 15 var encoded = encoder.convert([[],[[]]]); |
| 14 Expect.equals("[\n\x00[],\n\x00[\n\x00\x00[]\n\x00]\n]", encoded); | 16 Expect.equals("[\n\x00[],\n\x00[\n\x00\x00[]\n\x00]\n]", encoded); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 107 |
| 106 var compactOutput = JSON.encode(object); | 108 var compactOutput = JSON.encode(object); |
| 107 | 109 |
| 108 encoder = const JsonEncoder.withIndent(null); | 110 encoder = const JsonEncoder.withIndent(null); |
| 109 Expect.equals(compactOutput, encoder.convert(object)); | 111 Expect.equals(compactOutput, encoder.convert(object)); |
| 110 | 112 |
| 111 var prettyDecoded = JSON.decode(prettyOutput); | 113 var prettyDecoded = JSON.decode(prettyOutput); |
| 112 | 114 |
| 113 Expect.equals(compactOutput, JSON.encode(prettyDecoded)); | 115 Expect.equals(compactOutput, JSON.encode(prettyDecoded)); |
| 114 } | 116 } |
| OLD | NEW |