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:json' as json; | 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'; |
11 | 11 |
12 main() { | 12 main() { |
13 test('parse', () { | 13 test('parse', () { |
14 var mapping = parseJson(EXPECTED_MAP); | 14 var mapping = parseJson(EXPECTED_MAP); |
15 check(outputVar1, mapping, inputVar1, false); | 15 check(outputVar1, mapping, inputVar1, false); |
16 check(outputVar2, mapping, inputVar2, false); | 16 check(outputVar2, mapping, inputVar2, false); |
17 check(outputFunction, mapping, inputFunction, false); | 17 check(outputFunction, mapping, inputFunction, false); |
18 check(outputExpr, mapping, inputExpr, false); | 18 check(outputExpr, mapping, inputExpr, false); |
19 }); | 19 }); |
20 | 20 |
21 test('parse + json', () { | 21 test('parse + json', () { |
22 var mapping = parse(json.stringify(EXPECTED_MAP)); | 22 var mapping = parse(JSON.encode(EXPECTED_MAP)); |
23 check(outputVar1, mapping, inputVar1, false); | 23 check(outputVar1, mapping, inputVar1, false); |
24 check(outputVar2, mapping, inputVar2, false); | 24 check(outputVar2, mapping, inputVar2, false); |
25 check(outputFunction, mapping, inputFunction, false); | 25 check(outputFunction, mapping, inputFunction, false); |
26 check(outputExpr, mapping, inputExpr, false); | 26 check(outputExpr, mapping, inputExpr, false); |
27 }); | 27 }); |
28 | 28 |
29 test('parse with file', () { | 29 test('parse with file', () { |
30 var mapping = parseJson(EXPECTED_MAP); | 30 var mapping = parseJson(EXPECTED_MAP); |
31 check(outputVar1, mapping, inputVar1, true); | 31 check(outputVar1, mapping, inputVar1, true); |
32 check(outputVar2, mapping, inputVar2, true); | 32 check(outputVar2, mapping, inputVar2, true); |
33 check(outputFunction, mapping, inputFunction, true); | 33 check(outputFunction, mapping, inputFunction, true); |
34 check(outputExpr, mapping, inputExpr, true); | 34 check(outputExpr, mapping, inputExpr, true); |
35 }); | 35 }); |
36 } | 36 } |
OLD | NEW |