Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Unified Diff: pkg/yaml/test/utils.dart

Issue 302313007: Attach source range information to parsed YAML nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix tests Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/yaml/lib/yaml.dart ('k') | pkg/yaml/test/yaml_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/yaml/test/utils.dart
diff --git a/pkg/yaml/test/utils.dart b/pkg/yaml/test/utils.dart
index 0bac9f939e87eb621de71041a8f2ddb645cd2b6a..9c96ec10304b2602eea85d66c6ee9e56c48ba4e1 100644
--- a/pkg/yaml/test/utils.dart
+++ b/pkg/yaml/test/utils.dart
@@ -5,7 +5,7 @@
library yaml.test.utils;
import 'package:unittest/unittest.dart';
-import 'package:yaml/src/deep_equals.dart' as de;
+import 'package:yaml/src/equality.dart' as equality;
import 'package:yaml/yaml.dart';
/// A matcher that validates that a closure or Future throws a [YamlException].
@@ -14,25 +14,28 @@ final Matcher throwsYamlException = throwsA(new isInstanceOf<YamlException>());
/// Returns a matcher that asserts that the value equals [expected].
///
/// This handles recursive loops and considers `NaN` to equal itself.
-Matcher deepEquals(expected) =>
- predicate((actual) => de.deepEquals(actual, expected), "equals $expected");
+Matcher deepEquals(expected) => predicate((actual) =>
+ equality.deepEquals(actual, expected), "equals $expected");
/// Constructs a new yaml.YamlMap, optionally from a normal Map.
-Map yamlMap([Map from]) =>
- from == null ? new YamlMap() : new YamlMap.from(from);
+Map deepEqualsMap([Map from]) {
+ var map = equality.deepEqualsMap();
+ if (from != null) map.addAll(from);
+ return map;
+}
/// Asserts that a string containing a single YAML document produces a given
/// value when loaded.
void expectYamlLoads(expected, String source) {
var actual = loadYaml(cleanUpLiteral(source));
- expect(expected, deepEquals(actual));
+ expect(actual, deepEquals(expected));
}
/// Asserts that a string containing a stream of YAML documents produces a given
/// list of values when loaded.
void expectYamlStreamLoads(List expected, String source) {
var actual = loadYamlStream(cleanUpLiteral(source));
- expect(expected, deepEquals(actual));
+ expect(actual, deepEquals(expected));
}
/// Asserts that a string containing a single YAML document throws a
« no previous file with comments | « pkg/yaml/lib/yaml.dart ('k') | pkg/yaml/test/yaml_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698