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 library yaml.test.utils; | 5 library yaml.test.utils; |
6 | 6 |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:test/test.dart'; |
8 import 'package:yaml/src/equality.dart' as equality; | 8 import 'package:yaml/src/equality.dart' as equality; |
9 import 'package:yaml/yaml.dart'; | 9 import 'package:yaml/yaml.dart'; |
10 | 10 |
11 /// A matcher that validates that a closure or Future throws a [YamlException]. | 11 /// A matcher that validates that a closure or Future throws a [YamlException]. |
12 final Matcher throwsYamlException = throwsA(new isInstanceOf<YamlException>()); | 12 final Matcher throwsYamlException = throwsA(new isInstanceOf<YamlException>()); |
13 | 13 |
14 /// Returns a matcher that asserts that the value equals [expected]. | 14 /// Returns a matcher that asserts that the value equals [expected]. |
15 /// | 15 /// |
16 /// This handles recursive loops and considers `NaN` to equal itself. | 16 /// This handles recursive loops and considers `NaN` to equal itself. |
17 Matcher deepEquals(expected) => predicate((actual) => | 17 Matcher deepEquals(expected) => predicate((actual) => |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 String indentLiteral(String text) { | 77 String indentLiteral(String text) { |
78 var lines = text.split('\n'); | 78 var lines = text.split('\n'); |
79 if (lines.length <= 1) return text; | 79 if (lines.length <= 1) return text; |
80 | 80 |
81 for (var i = 0; i < lines.length; i++) { | 81 for (var i = 0; i < lines.length; i++) { |
82 lines[i] = " ${lines[i]}"; | 82 lines[i] = " ${lines[i]}"; |
83 } | 83 } |
84 | 84 |
85 return lines.join("\n"); | 85 return lines.join("\n"); |
86 } | 86 } |
OLD | NEW |