Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: pkg/source_maps/test/parser_test.dart

Issue 372153002: Moving logic for writing source maps from SourceMapBuilder into the Mapping class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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: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';
(...skipping 27 matching lines...) Expand all
38 38
39 main() { 39 main() {
40 test('parse', () { 40 test('parse', () {
41 var mapping = parseJson(EXPECTED_MAP); 41 var mapping = parseJson(EXPECTED_MAP);
42 check(outputVar1, mapping, inputVar1, false); 42 check(outputVar1, mapping, inputVar1, false);
43 check(outputVar2, mapping, inputVar2, false); 43 check(outputVar2, mapping, inputVar2, false);
44 check(outputFunction, mapping, inputFunction, false); 44 check(outputFunction, mapping, inputFunction, false);
45 check(outputExpr, mapping, inputExpr, false); 45 check(outputExpr, mapping, inputExpr, false);
46 }); 46 });
47 47
48 test('parse and re-emit', () {
49 for (var expected in [
50 EXPECTED_MAP,
51 MAP_WITH_NO_SOURCE_LOCATION,
52 MAP_WITH_SOURCE_LOCATION,
53 MAP_WITH_SOURCE_LOCATION_AND_NAME]) {
54 var mapping = parseJson(expected);
55 expect(mapping.toMap(), equals(expected));
56 }
57 });
58
48 test('parse + json', () { 59 test('parse + json', () {
49 var mapping = parse(JSON.encode(EXPECTED_MAP)); 60 var mapping = parse(JSON.encode(EXPECTED_MAP));
50 check(outputVar1, mapping, inputVar1, false); 61 check(outputVar1, mapping, inputVar1, false);
51 check(outputVar2, mapping, inputVar2, false); 62 check(outputVar2, mapping, inputVar2, false);
52 check(outputFunction, mapping, inputFunction, false); 63 check(outputFunction, mapping, inputFunction, false);
53 check(outputExpr, mapping, inputExpr, false); 64 check(outputExpr, mapping, inputExpr, false);
54 }); 65 });
55 66
56 test('parse with file', () { 67 test('parse with file', () {
57 var mapping = parseJson(EXPECTED_MAP); 68 var mapping = parseJson(EXPECTED_MAP);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 expect(map.lines.first.entries.length, 1); 104 expect(map.lines.first.entries.length, 1);
94 TargetEntry entry = map.lines.first.entries.first; 105 TargetEntry entry = map.lines.first.entries.first;
95 106
96 expect(entry.sourceUrlId, 0); 107 expect(entry.sourceUrlId, 0);
97 expect(entry.sourceUrlId, 0); 108 expect(entry.sourceUrlId, 0);
98 expect(entry.sourceColumn, 0); 109 expect(entry.sourceColumn, 0);
99 expect(entry.sourceLine, 0); 110 expect(entry.sourceLine, 0);
100 expect(entry.sourceNameId, 0); 111 expect(entry.sourceNameId, 0);
101 }); 112 });
102 } 113 }
OLDNEW
« pkg/source_maps/lib/parser.dart ('K') | « pkg/source_maps/lib/parser.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698