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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 test.printer_test; 5 library test.printer_test;
6 6
7 import 'dart:json' as json; 7 import 'dart:json' as json;
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import 'package:source_maps/printer.dart'; 9 import 'package:source_maps/printer.dart';
10 import 'package:source_maps/span.dart'; 10 import 'package:source_maps/span.dart';
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ..add(segments[3], projectMarks: true) 72 ..add(segments[3], projectMarks: true)
73 ..mark(asFixed(inputExpr)) 73 ..mark(asFixed(inputExpr))
74 ..add('_s') 74 ..add('_s')
75 ..add(segments[4], projectMarks: true) 75 ..add(segments[4], projectMarks: true)
76 ..add('_s') 76 ..add('_s')
77 ..add(segments[5], projectMarks: true); 77 ..add(segments[5], projectMarks: true);
78 78
79 expect(printer2.text, out); 79 expect(printer2.text, out);
80 expect(printer2.map, printer.map); 80 expect(printer2.map, printer.map);
81 }); 81 });
82
83 group('nested printer', () {
84 test('simple use', () {
85 var printer = new NestedPrinter();
86 printer..add('var ')
87 ..add('x = 3;\n', location: inputVar1)
88 ..add('f(', location: inputFunction)
89 ..add('y) => ', location: inputVar2)
90 ..add('x + y;\n', location: inputExpr)
91 ..build('output.dart');
92 expect(printer.text, OUTPUT);
93 expect(printer.map, json.stringify(EXPECTED_MAP));
94 });
95
96 test('nested use', () {
97 var printer = new NestedPrinter();
98 printer..add('var ')
99 ..add(new NestedPrinter()..add('x = 3;\n', location: inputVar1))
100 ..add('f(', location: inputFunction)
101 ..add(new NestedPrinter()..add('y) => ', location: inputVar2))
102 ..add('x + y;\n', location: inputExpr)
103 ..build('output.dart');
104 expect(printer.text, OUTPUT);
105 expect(printer.map, json.stringify(EXPECTED_MAP));
106 });
107
108 test('add indentation', () {
109 var out = INPUT.replaceAll('long', '_s');
110 var lines = INPUT.trim().split('\n');
111 expect(lines.length, 7);
112 var printer = new NestedPrinter();
113 for (int i = 0; i < lines.length; i++) {
114 if (i == 5) printer.indent++;
115 printer.addLine(lines[i].replaceAll('long', '_s').trim());
116 if (i == 5) printer.indent--;
117 }
118 printer.build('output.dart');
119 expect(printer.text, out);
120 });
121 });
82 } 122 }
OLDNEW
« 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