Index: pkg/source_maps/test/parser_test.dart |
diff --git a/pkg/source_maps/test/parser_test.dart b/pkg/source_maps/test/parser_test.dart |
index c99acb2f10ac4eba95a86a1001a0cac144b3744d..afdd7fb2c0396a2ebb0c1943cb501ea7fe7a6f27 100644 |
--- a/pkg/source_maps/test/parser_test.dart |
+++ b/pkg/source_maps/test/parser_test.dart |
@@ -9,6 +9,33 @@ import 'package:unittest/unittest.dart'; |
import 'package:source_maps/source_maps.dart'; |
import 'common.dart'; |
+const Map<String, dynamic> MAP_WITH_NO_SOURCE_LOCATION = const { |
+ 'version': 3, |
+ 'sourceRoot': '', |
+ 'sources': const ['input.dart'], |
+ 'names': const [], |
+ 'mappings': 'A', |
+ 'file': 'output.dart' |
+}; |
+ |
+const Map<String, dynamic> MAP_WITH_SOURCE_LOCATION = const { |
+ 'version': 3, |
+ 'sourceRoot': '', |
+ 'sources': const ['input.dart'], |
+ 'names': const [], |
+ 'mappings': 'AAAA', |
+ 'file': 'output.dart' |
+}; |
+ |
+const Map<String, dynamic> MAP_WITH_SOURCE_LOCATION_AND_NAME = const { |
+ 'version': 3, |
+ 'sourceRoot': '', |
+ 'sources': const ['input.dart'], |
+ 'names': const ['var'], |
+ 'mappings': 'AAAAA', |
+ 'file': 'output.dart' |
+}; |
+ |
main() { |
test('parse', () { |
var mapping = parseJson(EXPECTED_MAP); |
@@ -33,4 +60,43 @@ main() { |
check(outputFunction, mapping, inputFunction, true); |
check(outputExpr, mapping, inputExpr, true); |
}); |
+ |
+ test('parse with no source location', () { |
+ SingleMapping map = parse(JSON.encode(MAP_WITH_NO_SOURCE_LOCATION)); |
+ expect(map.lines.length, 1); |
+ expect(map.lines.first.entries.length, 1); |
+ TargetEntry entry = map.lines.first.entries.first; |
+ |
+ expect(entry.column, 0); |
+ expect(entry.sourceUrlId, null); |
+ expect(entry.sourceColumn, null); |
+ expect(entry.sourceLine, null); |
+ expect(entry.sourceNameId, null); |
+ }); |
+ |
+ test('parse with source location and no name', () { |
+ SingleMapping map = parse(JSON.encode(MAP_WITH_SOURCE_LOCATION)); |
+ expect(map.lines.length, 1); |
+ expect(map.lines.first.entries.length, 1); |
+ TargetEntry entry = map.lines.first.entries.first; |
+ |
+ expect(entry.column, 0); |
+ expect(entry.sourceUrlId, 0); |
+ expect(entry.sourceColumn, 0); |
+ expect(entry.sourceLine, 0); |
+ expect(entry.sourceNameId, null); |
+ }); |
+ |
+ test('parse with source location and name', () { |
+ SingleMapping map = parse(JSON.encode(MAP_WITH_SOURCE_LOCATION_AND_NAME)); |
+ expect(map.lines.length, 1); |
+ expect(map.lines.first.entries.length, 1); |
+ TargetEntry entry = map.lines.first.entries.first; |
+ |
+ expect(entry.sourceUrlId, 0); |
+ expect(entry.sourceUrlId, 0); |
+ expect(entry.sourceColumn, 0); |
+ expect(entry.sourceLine, 0); |
+ expect(entry.sourceNameId, 0); |
+ }); |
} |