OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 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.
| |
6 | |
7 import 'package:source_maps/source_maps.dart'; | |
8 import 'package:unittest/unittest.dart'; | |
9 | |
10 import 'dart:convert'; | |
11 | |
12 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.
| |
13 'version': 3, | |
14 'sourceRoot': '', | |
15 'sources': const ['input.dart'], | |
16 'names': const [], | |
17 'mappings': 'A', | |
18 'file': 'output.dart' | |
19 }; | |
20 | |
21 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.
| |
22 'version': 3, | |
23 'sourceRoot': '', | |
24 'sources': const ['input.dart'], | |
25 'names': const [], | |
26 'mappings': 'AAAA', | |
27 'file': 'output.dart' | |
28 }; | |
29 | |
30 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.
| |
31 'version': 3, | |
32 'sourceRoot': '', | |
33 'sources': const ['input.dart'], | |
34 'names': const ['var'], | |
35 'mappings': 'AAAAA', | |
36 'file': 'output.dart' | |
37 }; | |
38 | |
39 main() { | |
40 SingleMapping map = parse(JSON.encode(MAP_WITH_NO_SOURCE_LOCATION)); | |
41 expect(map.lines.length, 1); | |
42 expect(map.lines.first.entries.length, 1); | |
43 TargetEntry entry = map.lines.first.entries.first; | |
44 | |
45 expect(entry.column, 0); | |
46 expect(entry.sourceUrlId, null); | |
47 expect(entry.sourceColumn, null); | |
48 expect(entry.sourceLine, null); | |
49 expect(entry.sourceNameId, null); | |
50 | |
51 map = parse(JSON.encode(MAP_WITH_SOURCE_LOCATION)); | |
52 expect(map.lines.length, 1); | |
53 expect(map.lines.first.entries.length, 1); | |
54 entry = map.lines.first.entries.first; | |
55 | |
56 expect(entry.column, 0); | |
57 expect(entry.sourceUrlId, 0); | |
58 expect(entry.sourceColumn, 0); | |
59 expect(entry.sourceLine, 0); | |
60 expect(entry.sourceNameId, null); | |
61 | |
62 map = parse(JSON.encode(MAP_WITH_SOURCE_LOCATION_AND_NAME)); | |
63 expect(map.lines.length, 1); | |
64 expect(map.lines.first.entries.length, 1); | |
65 entry = map.lines.first.entries.first; | |
66 | |
67 expect(entry.sourceUrlId, 0); | |
68 expect(entry.sourceUrlId, 0); | |
69 expect(entry.sourceColumn, 0); | |
70 expect(entry.sourceLine, 0); | |
71 expect(entry.sourceNameId, 0); | |
72 } | |
OLD | NEW |