| OLD | NEW |
| 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:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 import 'package:source_maps/source_maps.dart'; | 9 import 'package:source_maps/source_maps.dart'; |
| 10 import 'common.dart'; | 10 import 'common.dart'; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 expect(mapping.spanFor(0, 0).sourceUrl, Uri.parse("/pkg/input.dart")); | 107 expect(mapping.spanFor(0, 0).sourceUrl, Uri.parse("/pkg/input.dart")); |
| 108 | 108 |
| 109 var newSourceRoot = '/new/'; | 109 var newSourceRoot = '/new/'; |
| 110 | 110 |
| 111 mapping.sourceRoot = newSourceRoot; | 111 mapping.sourceRoot = newSourceRoot; |
| 112 inputMap["sourceRoot"] = newSourceRoot; | 112 inputMap["sourceRoot"] = newSourceRoot; |
| 113 | 113 |
| 114 expect(mapping.toJson(), equals(inputMap)); | 114 expect(mapping.toJson(), equals(inputMap)); |
| 115 }); | 115 }); |
| 116 | 116 |
| 117 test('parse with map URL', () { |
| 118 var inputMap = new Map.from(MAP_WITH_SOURCE_LOCATION); |
| 119 inputMap['sourceRoot'] = 'pkg/'; |
| 120 var mapping = parseJson(inputMap, mapUrl: "file:///path/to/map"); |
| 121 expect(mapping.spanFor(0, 0).sourceUrl, |
| 122 Uri.parse("file:///path/to/pkg/input.dart")); |
| 123 }); |
| 124 |
| 117 test('parse and re-emit', () { | 125 test('parse and re-emit', () { |
| 118 for (var expected in [ | 126 for (var expected in [ |
| 119 EXPECTED_MAP, | 127 EXPECTED_MAP, |
| 120 MAP_WITH_NO_SOURCE_LOCATION, | 128 MAP_WITH_NO_SOURCE_LOCATION, |
| 121 MAP_WITH_SOURCE_LOCATION, | 129 MAP_WITH_SOURCE_LOCATION, |
| 122 MAP_WITH_SOURCE_LOCATION_AND_NAME]) { | 130 MAP_WITH_SOURCE_LOCATION_AND_NAME]) { |
| 123 var mapping = parseJson(expected); | 131 var mapping = parseJson(expected); |
| 124 expect(mapping.toJson(), equals(expected)); | 132 expect(mapping.toJson(), equals(expected)); |
| 125 } | 133 } |
| 126 }); | 134 }); |
| 127 } | 135 } |
| OLD | NEW |