Chromium Code Reviews| Index: pkg/source_maps/test/parse_map_with_no_source_location_test.dart |
| diff --git a/pkg/source_maps/test/parse_map_with_no_source_location_test.dart b/pkg/source_maps/test/parse_map_with_no_source_location_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..148509c9918acaccc9b7696d3bc5cbcdbf79321d |
| --- /dev/null |
| +++ b/pkg/source_maps/test/parse_map_with_no_source_location_test.dart |
| @@ -0,0 +1,72 @@ |
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +library test.parser_test; |
|
Siggi Cherem (dart-lang)
2014/04/18 02:00:31
let's move these tests into parser_test.dart, as 3
zarah
2014/04/23 07:52:12
Done.
|
| + |
| +import 'package:source_maps/source_maps.dart'; |
| +import 'package:unittest/unittest.dart'; |
| + |
| +import 'dart:convert'; |
| + |
| +const Map<String, dynamic>MAP_WITH_NO_SOURCE_LOCATION = const { |
|
Johnni Winther
2014/04/15 06:50:19
Add space between type and variable.
zarah
2014/04/23 07:52:12
Done.
|
| + 'version': 3, |
| + 'sourceRoot': '', |
| + 'sources': const ['input.dart'], |
| + 'names': const [], |
| + 'mappings': 'A', |
| + 'file': 'output.dart' |
| +}; |
| + |
| +const Map<String, dynamic>MAP_WITH_SOURCE_LOCATION = const { |
|
Johnni Winther
2014/04/15 06:50:19
Ditto.
zarah
2014/04/23 07:52:12
Done.
|
| + '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 { |
|
Johnni Winther
2014/04/15 06:50:19
Ditto.
zarah
2014/04/23 07:52:12
Done.
|
| + 'version': 3, |
| + 'sourceRoot': '', |
| + 'sources': const ['input.dart'], |
| + 'names': const ['var'], |
| + 'mappings': 'AAAAA', |
| + 'file': 'output.dart' |
| +}; |
| + |
| +main() { |
| + 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); |
| + |
| + map = parse(JSON.encode(MAP_WITH_SOURCE_LOCATION)); |
| + expect(map.lines.length, 1); |
| + expect(map.lines.first.entries.length, 1); |
| + 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); |
| + |
| + map = parse(JSON.encode(MAP_WITH_SOURCE_LOCATION_AND_NAME)); |
| + expect(map.lines.length, 1); |
| + expect(map.lines.first.entries.length, 1); |
| + 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); |
| +} |