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

Side by Side Diff: test/parser_test.dart

Issue 2564683003: Improve handling of locations not from the uris the source map is for. (Closed)
Patch Set: Improve handling of locations not from the uris the source map is for. Make `MappingBundle` disting… Created 4 years 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
« lib/parser.dart ('K') | « pubspec.yaml ('k') | no next file » | 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.parser_test; 5 library test.parser_test;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 import 'package:source_maps/source_maps.dart'; 9 import 'package:source_maps/source_maps.dart';
10 import 'package:source_span/source_span.dart'; 10 import 'package:source_span/source_span.dart';
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 expect( 172 expect(
173 mapping.spanFor(0, 0, uri: "file:///path/to/output1.dart").sourceUrl, 173 mapping.spanFor(0, 0, uri: "file:///path/to/output1.dart").sourceUrl,
174 Uri.parse("file:///path/to/pkg/input1.dart")); 174 Uri.parse("file:///path/to/pkg/input1.dart"));
175 expect( 175 expect(
176 mapping.spanFor(0, 0, uri: "file:///path/to/output2.dart").sourceUrl, 176 mapping.spanFor(0, 0, uri: "file:///path/to/output2.dart").sourceUrl,
177 Uri.parse("file:///path/to/pkg/input2.dart")); 177 Uri.parse("file:///path/to/pkg/input2.dart"));
178 }); 178 });
179 179
180 test('unmapped path', () { 180 test('unmapped path', () {
181 expect(mapping.spanFor(0, 0, uri: "unmapped_output.dart"), isNull); 181 var span = mapping.spanFor(0, 0, uri: "unmapped_output.dart");
182 expect(span.sourceUrl, Uri.parse("unmapped_output.dart"));
183 expect(span.start.line, equals(0));
184 expect(span.start.column, equals(0));
185
186 span = mapping.spanFor(10, 5, uri: "unmapped_output.dart");
187 expect(span.sourceUrl, Uri.parse("unmapped_output.dart"));
188 expect(span.start.line, equals(10));
189 expect(span.start.column, equals(5));
182 }); 190 });
183 191
184 test('missing path', () { 192 test('missing path', () {
185 expect(() => mapping.spanFor(0, 0), throws); 193 expect(() => mapping.spanFor(0, 0), throws);
186 }); 194 });
187 195
188 test('incomplete paths', () { 196 test('incomplete paths', () {
189 expect(mapping.spanFor(0, 0, uri: "output1.dart").sourceUrl, 197 expect(mapping.spanFor(0, 0, uri: "output1.dart").sourceUrl,
190 Uri.parse("file:///path/to/pkg/input1.dart")); 198 Uri.parse("file:///path/to/pkg/input1.dart"));
191 expect(mapping.spanFor(0, 0, uri: "output2.dart").sourceUrl, 199 expect(mapping.spanFor(0, 0, uri: "output2.dart").sourceUrl,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 mapping = parseJsonExtended(expected); 249 mapping = parseJsonExtended(expected);
242 expect(mapping.toJson(), equals(expected)); 250 expect(mapping.toJson(), equals(expected));
243 } 251 }
244 // Invalid for this case 252 // Invalid for this case
245 expect(() => parseJson(SOURCE_MAP_BUNDLE), throws); 253 expect(() => parseJson(SOURCE_MAP_BUNDLE), throws);
246 254
247 var mapping = parseJsonExtended(SOURCE_MAP_BUNDLE); 255 var mapping = parseJsonExtended(SOURCE_MAP_BUNDLE);
248 expect(mapping.toJson(), equals(SOURCE_MAP_BUNDLE)); 256 expect(mapping.toJson(), equals(SOURCE_MAP_BUNDLE));
249 }); 257 });
250 } 258 }
OLDNEW
« lib/parser.dart ('K') | « pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698