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