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

Unified Diff: pkg/source_maps/test/printer_test.dart

Issue 22396004: Make observable transform a barback transform. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/source_maps/lib/source_maps.dart ('k') | pkg/source_maps/test/refactor_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/source_maps/test/printer_test.dart
diff --git a/pkg/source_maps/test/printer_test.dart b/pkg/source_maps/test/printer_test.dart
index d038ad51babce2a548f44c654bfd229b2013f52e..06bed57685e4624cfb74b358377d7414f5317a43 100644
--- a/pkg/source_maps/test/printer_test.dart
+++ b/pkg/source_maps/test/printer_test.dart
@@ -79,4 +79,44 @@ main() {
expect(printer2.text, out);
expect(printer2.map, printer.map);
});
+
+ group('nested printer', () {
+ test('simple use', () {
+ var printer = new NestedPrinter();
+ printer..add('var ')
+ ..add('x = 3;\n', location: inputVar1)
+ ..add('f(', location: inputFunction)
+ ..add('y) => ', location: inputVar2)
+ ..add('x + y;\n', location: inputExpr)
+ ..build('output.dart');
+ expect(printer.text, OUTPUT);
+ expect(printer.map, json.stringify(EXPECTED_MAP));
+ });
+
+ test('nested use', () {
+ var printer = new NestedPrinter();
+ printer..add('var ')
+ ..add(new NestedPrinter()..add('x = 3;\n', location: inputVar1))
+ ..add('f(', location: inputFunction)
+ ..add(new NestedPrinter()..add('y) => ', location: inputVar2))
+ ..add('x + y;\n', location: inputExpr)
+ ..build('output.dart');
+ expect(printer.text, OUTPUT);
+ expect(printer.map, json.stringify(EXPECTED_MAP));
+ });
+
+ test('add indentation', () {
+ var out = INPUT.replaceAll('long', '_s');
+ var lines = INPUT.trim().split('\n');
+ expect(lines.length, 7);
+ var printer = new NestedPrinter();
+ for (int i = 0; i < lines.length; i++) {
+ if (i == 5) printer.indent++;
+ printer.addLine(lines[i].replaceAll('long', '_s').trim());
+ if (i == 5) printer.indent--;
+ }
+ printer.build('output.dart');
+ expect(printer.text, out);
+ });
+ });
}
« no previous file with comments | « pkg/source_maps/lib/source_maps.dart ('k') | pkg/source_maps/test/refactor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698