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

Side by Side Diff: test/common.dart

Issue 12937009: renaming File to Source (Closed) Base URL: git@github.com:dart-lang/source-maps.git@master
Patch Set: Created 7 years, 9 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
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 /// Common input/output used by builder, parser and end2end tests 5 /// Common input/output used by builder, parser and end2end tests
6 library test.common; 6 library test.common;
7 7
8 import 'package:source_maps/source_maps.dart'; 8 import 'package:source_maps/source_maps.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 /// Content of the source file 11 /// Content of the source file
12 const String INPUT = ''' 12 const String INPUT = '''
13 /** this is a comment. */ 13 /** this is a comment. */
14 int longVar1 = 3; 14 int longVar1 = 3;
15 15
16 // this is a comment too 16 // this is a comment too
17 int longName(int longVar2) { 17 int longName(int longVar2) {
18 return longVar1 + longVar2; 18 return longVar1 + longVar2;
19 } 19 }
20 '''; 20 ''';
21 var input = new File.text('input.dart', INPUT); 21 var input = new SourceFile.text('input.dart', INPUT);
22 22
23 /// A span in the input file 23 /// A span in the input file
24 Span ispan(int start, int end, [bool isIdentifier = false]) => 24 Span ispan(int start, int end, [bool isIdentifier = false]) =>
25 new FileSpan(input, start, end, isIdentifier); 25 new FileSpan(input, start, end, isIdentifier);
26 26
27 Span inputVar1 = ispan(30, 38, true); 27 Span inputVar1 = ispan(30, 38, true);
28 Span inputFunction = ispan(74, 82, true); 28 Span inputFunction = ispan(74, 82, true);
29 Span inputVar2 = ispan(87, 95, true); 29 Span inputVar2 = ispan(87, 95, true);
30 Span inputExpr = ispan(108, 127); 30 Span inputExpr = ispan(108, 127);
31 31
32 /// Content of the target file 32 /// Content of the target file
33 const String OUTPUT = ''' 33 const String OUTPUT = '''
34 var x = 3; 34 var x = 3;
35 f(y) => x + y; 35 f(y) => x + y;
36 '''; 36 ''';
37 var output = new File.text('output.dart', OUTPUT); 37 var output = new SourceFile.text('output.dart', OUTPUT);
38 38
39 /// A span in the output file 39 /// A span in the output file
40 Span ospan(int start, int end, [bool isIdentifier = false]) => 40 Span ospan(int start, int end, [bool isIdentifier = false]) =>
41 new FileSpan(output, start, end, isIdentifier); 41 new FileSpan(output, start, end, isIdentifier);
42 42
43 Span outputVar1 = ospan(4, 5, true); 43 Span outputVar1 = ospan(4, 5, true);
44 Span outputFunction = ospan(11, 12, true); 44 Span outputFunction = ospan(11, 12, true);
45 Span outputVar2 = ospan(13, 14, true); 45 Span outputVar2 = ospan(13, 14, true);
46 Span outputExpr = ospan(19, 24); 46 Span outputExpr = ospan(19, 24);
47 47
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 expect(span.end.line, inputSpan.end.line); 88 expect(span.end.line, inputSpan.end.line);
89 expect(span.end.column, inputSpan.end.column); 89 expect(span.end.column, inputSpan.end.column);
90 expect(span.end.offset, span.start.offset + inputSpan.text.length); 90 expect(span.end.offset, span.start.offset + inputSpan.text.length);
91 if (realOffsets) expect(span.end.offset, inputSpan.end.offset); 91 if (realOffsets) expect(span.end.offset, inputSpan.end.offset);
92 } else { 92 } else {
93 expect(span.end.offset, span.start.offset); 93 expect(span.end.offset, span.start.offset);
94 expect(span.end.line, span.start.line); 94 expect(span.end.line, span.start.line);
95 expect(span.end.column, span.start.column); 95 expect(span.end.column, span.start.column);
96 } 96 }
97 } 97 }
OLDNEW
« lib/source_maps.dart ('K') | « pubspec.yaml ('k') | test/end2end_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698