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.source_maps_test; | 5 library test.source_maps_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'; |
11 | 11 |
12 main() { | 12 main() { |
13 test('builder - with span', () { | 13 test('builder - with span', () { |
14 var map = (new SourceMapBuilder() | 14 var map = (new SourceMapBuilder() |
15 ..addSpan(inputVar1, outputVar1) | 15 ..addSpan(inputVar1, outputVar1) |
16 ..addSpan(inputFunction, outputFunction) | 16 ..addSpan(inputFunction, outputFunction) |
17 ..addSpan(inputVar2, outputVar2) | 17 ..addSpan(inputVar2, outputVar2) |
18 ..addSpan(inputExpr, outputExpr)) | 18 ..addSpan(inputExpr, outputExpr)) |
19 .build(output.url); | 19 .build(output.url.toString()); |
20 expect(map, equals(EXPECTED_MAP)); | 20 expect(map, equals(EXPECTED_MAP)); |
21 }); | 21 }); |
22 | 22 |
23 test('builder - with location', () { | 23 test('builder - with location', () { |
24 var str = (new SourceMapBuilder() | 24 var str = (new SourceMapBuilder() |
25 ..addLocation(inputVar1.start, outputVar1.start, 'longVar1') | 25 ..addLocation(inputVar1.start, outputVar1.start, 'longVar1') |
26 ..addLocation(inputFunction.start, outputFunction.start, 'longName') | 26 ..addLocation(inputFunction.start, outputFunction.start, 'longName') |
27 ..addLocation(inputVar2.start, outputVar2.start, 'longVar2') | 27 ..addLocation(inputVar2.start, outputVar2.start, 'longVar2') |
28 ..addLocation(inputExpr.start, outputExpr.start, null)) | 28 ..addLocation(inputExpr.start, outputExpr.start, null)) |
29 .toJson(output.url); | 29 .toJson(output.url.toString()); |
30 expect(str, JSON.encode(EXPECTED_MAP)); | 30 expect(str, JSON.encode(EXPECTED_MAP)); |
31 }); | 31 }); |
32 } | 32 } |
OLD | NEW |