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

Unified Diff: pkg/js_ast/test/printer_callback_test.dart

Issue 1213783004: Make js_ast test line-ending agnostic. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/js_ast/test/printer_callback_test.dart
diff --git a/pkg/js_ast/test/printer_callback_test.dart b/pkg/js_ast/test/printer_callback_test.dart
index b4ff074256cf273ad87d82e8bb522ba705322748..e4bcf835d2f36f4c14cd0771bd27a0a04ee3edc1 100644
--- a/pkg/js_ast/test/printer_callback_test.dart
+++ b/pkg/js_ast/test/printer_callback_test.dart
@@ -105,11 +105,15 @@ void check(Map<TestMode, String> map) {
map.forEach((TestMode mode, String expectedOutput) {
Context context = new Context(mode);
new Printer(options, context).visit(node);
- expect(context.getText(), equals(expectedOutput),
+ expect(context.getText(),
+ equals(canonicalizeLineEndings(expectedOutput)),
reason: "Unexpected output for $code in $mode");
});
}
+// The string literals may end in \r\n or \n depending on filesystem.
+canonicalizeLineEndings(String s) => s.replaceAll('\r\n', '\n');
+
class Context extends SimpleJavaScriptPrintingContext {
final TestMode mode;
final Map<Node, int> idMap = {};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698