OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/src/pretty_print.dart'; | 5 import 'package:unittest/src/pretty_print.dart'; |
6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
7 | 7 |
8 void main() { | 8 void main() { |
9 test('with primitive objects', () { | 9 test('with primitive objects', () { |
10 expect(prettyPrint(12), equals('<12>')); | 10 expect(prettyPrint(12), equals('<12>')); |
11 expect(prettyPrint(12.13), equals('<12.13>')); | 11 expect(prettyPrint(12.13), equals('<12.13>')); |
12 expect(prettyPrint(true), equals('<true>')); | 12 expect(prettyPrint(true), equals('<true>')); |
13 expect(prettyPrint(null), equals('<null>')); | 13 expect(prettyPrint(null), equals('<null>')); |
14 expect(prettyPrint(() => 12), | 14 expect(prettyPrint(() => 12), |
15 matches(r'<Closure(: \(dynamic\) => dynamic)?>')); | 15 matches(r'<Closure(: \(\) => dynamic)?>')); |
16 }); | 16 }); |
17 | 17 |
18 group('with a string', () { | 18 group('with a string', () { |
19 test('containing simple characters', () { | 19 test('containing simple characters', () { |
20 expect(prettyPrint('foo'), equals("'foo'")); | 20 expect(prettyPrint('foo'), equals("'foo'")); |
21 }); | 21 }); |
22 | 22 |
23 test('containing newlines', () { | 23 test('containing newlines', () { |
24 expect(prettyPrint('foo\nbar\nbaz'), equals( | 24 expect(prettyPrint('foo\nbar\nbaz'), equals( |
25 "'foo\\n'\n" | 25 "'foo\\n'\n" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 4), | 172 expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 4), |
173 equals("{'0': 1, '2': 3, '4': 5, '6': 7}")); | 173 equals("{'0': 1, '2': 3, '4': 5, '6': 7}")); |
174 }); | 174 }); |
175 | 175 |
176 test("that's over maxItems", () { | 176 test("that's over maxItems", () { |
177 expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 3), | 177 expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 3), |
178 equals("{'0': 1, '2': 3, ...}")); | 178 equals("{'0': 1, '2': 3, ...}")); |
179 }); | 179 }); |
180 }); | 180 }); |
181 } | 181 } |
OLD | NEW |