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

Side by Side Diff: pkg/yaml/test/yaml_node_wrapper_test.dart

Issue 401753002: Move a number of packages and some of pub over to using source_span. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes 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
« no previous file with comments | « pkg/yaml/pubspec.yaml ('k') | sdk/lib/_internal/pub/lib/src/barback/transformer_config.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 yaml.node_wrapper_test; 5 library yaml.node_wrapper_test;
6 6
7 import 'package:source_maps/source_maps.dart'; 7 import 'package:source_maps/source_maps.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import 'package:yaml/yaml.dart'; 9 import 'package:yaml/yaml.dart';
10 10
11 main() { 11 main() {
12 test("YamlMap() with no sourceName", () { 12 test("YamlMap() with no sourceUrl", () {
13 var map = new YamlMap(); 13 var map = new YamlMap();
14 expect(map, isEmpty); 14 expect(map, isEmpty);
15 expect(map.nodes, isEmpty); 15 expect(map.nodes, isEmpty);
16 expect(map.span, isNullSpan(isNull)); 16 expect(map.span, isNullSpan(isNull));
17 }); 17 });
18 18
19 test("YamlMap() with a sourceName", () { 19 test("YamlMap() with a sourceUrl", () {
20 var map = new YamlMap(sourceName: "source"); 20 var map = new YamlMap(sourceUrl: "source");
21 expect(map.span, isNullSpan("source")); 21 expect(map.span, isNullSpan("source"));
22 }); 22 });
23 23
24 test("YamlList() with no sourceName", () { 24 test("YamlList() with no sourceUrl", () {
25 var list = new YamlList(); 25 var list = new YamlList();
26 expect(list, isEmpty); 26 expect(list, isEmpty);
27 expect(list.nodes, isEmpty); 27 expect(list.nodes, isEmpty);
28 expect(list.span, isNullSpan(isNull)); 28 expect(list.span, isNullSpan(isNull));
29 }); 29 });
30 30
31 test("YamlList() with a sourceName", () { 31 test("YamlList() with a sourceUrl", () {
32 var list = new YamlList(sourceName: "source"); 32 var list = new YamlList(sourceUrl: "source");
33 expect(list.span, isNullSpan("source")); 33 expect(list.span, isNullSpan("source"));
34 }); 34 });
35 35
36 test("YamlMap.wrap() with no sourceName", () { 36 test("YamlMap.wrap() with no sourceUrl", () {
37 var map = new YamlMap.wrap({ 37 var map = new YamlMap.wrap({
38 "list": [1, 2, 3], 38 "list": [1, 2, 3],
39 "map": { 39 "map": {
40 "foo": "bar", 40 "foo": "bar",
41 "nested": [4, 5, 6] 41 "nested": [4, 5, 6]
42 }, 42 },
43 "scalar": "value" 43 "scalar": "value"
44 }); 44 });
45 45
46 expect(map, equals({ 46 expect(map, equals({
(...skipping 15 matching lines...) Expand all
62 expect(map["map"].span, isNullSpan(isNull)); 62 expect(map["map"].span, isNullSpan(isNull));
63 expect(map.nodes["scalar"], new isInstanceOf<YamlScalar>()); 63 expect(map.nodes["scalar"], new isInstanceOf<YamlScalar>());
64 expect(map.nodes["scalar"].value, "value"); 64 expect(map.nodes["scalar"].value, "value");
65 expect(map.nodes["scalar"].span, isNullSpan(isNull)); 65 expect(map.nodes["scalar"].span, isNullSpan(isNull));
66 expect(map["scalar"], "value"); 66 expect(map["scalar"], "value");
67 expect(map.keys, unorderedEquals(["list", "map", "scalar"])); 67 expect(map.keys, unorderedEquals(["list", "map", "scalar"]));
68 expect(map.nodes.keys, everyElement(new isInstanceOf<YamlScalar>())); 68 expect(map.nodes.keys, everyElement(new isInstanceOf<YamlScalar>()));
69 expect(map.nodes[new YamlScalar.wrap("list")], equals([1, 2, 3])); 69 expect(map.nodes[new YamlScalar.wrap("list")], equals([1, 2, 3]));
70 }); 70 });
71 71
72 test("YamlMap.wrap() with a sourceName", () { 72 test("YamlMap.wrap() with a sourceUrl", () {
73 var map = new YamlMap.wrap({ 73 var map = new YamlMap.wrap({
74 "list": [1, 2, 3], 74 "list": [1, 2, 3],
75 "map": { 75 "map": {
76 "foo": "bar", 76 "foo": "bar",
77 "nested": [4, 5, 6] 77 "nested": [4, 5, 6]
78 }, 78 },
79 "scalar": "value" 79 "scalar": "value"
80 }, sourceName: "source"); 80 }, sourceUrl: "source");
81 81
82 expect(map.span, isNullSpan("source")); 82 expect(map.span, isNullSpan("source"));
83 expect(map["list"].span, isNullSpan("source")); 83 expect(map["list"].span, isNullSpan("source"));
84 expect(map["map"].span, isNullSpan("source")); 84 expect(map["map"].span, isNullSpan("source"));
85 expect(map.nodes["scalar"].span, isNullSpan("source")); 85 expect(map.nodes["scalar"].span, isNullSpan("source"));
86 }); 86 });
87 87
88 test("YamlList.wrap() with no sourceName", () { 88 test("YamlList.wrap() with no sourceUrl", () {
89 var list = new YamlList.wrap([ 89 var list = new YamlList.wrap([
90 [1, 2, 3], 90 [1, 2, 3],
91 { 91 {
92 "foo": "bar", 92 "foo": "bar",
93 "nested": [4, 5, 6] 93 "nested": [4, 5, 6]
94 }, 94 },
95 "value" 95 "value"
96 ]); 96 ]);
97 97
98 expect(list, equals([ 98 expect(list, equals([
(...skipping 12 matching lines...) Expand all
111 expect(list[1], new isInstanceOf<YamlMap>()); 111 expect(list[1], new isInstanceOf<YamlMap>());
112 expect(list[1].nodes["foo"], new isInstanceOf<YamlScalar>()); 112 expect(list[1].nodes["foo"], new isInstanceOf<YamlScalar>());
113 expect(list[1]["nested"], new isInstanceOf<YamlList>()); 113 expect(list[1]["nested"], new isInstanceOf<YamlList>());
114 expect(list[1].span, isNullSpan(isNull)); 114 expect(list[1].span, isNullSpan(isNull));
115 expect(list.nodes[2], new isInstanceOf<YamlScalar>()); 115 expect(list.nodes[2], new isInstanceOf<YamlScalar>());
116 expect(list.nodes[2].value, "value"); 116 expect(list.nodes[2].value, "value");
117 expect(list.nodes[2].span, isNullSpan(isNull)); 117 expect(list.nodes[2].span, isNullSpan(isNull));
118 expect(list[2], "value"); 118 expect(list[2], "value");
119 }); 119 });
120 120
121 test("YamlList.wrap() with a sourceName", () { 121 test("YamlList.wrap() with a sourceUrl", () {
122 var list = new YamlList.wrap([ 122 var list = new YamlList.wrap([
123 [1, 2, 3], 123 [1, 2, 3],
124 { 124 {
125 "foo": "bar", 125 "foo": "bar",
126 "nested": [4, 5, 6] 126 "nested": [4, 5, 6]
127 }, 127 },
128 "value" 128 "value"
129 ]); 129 ]);
130 130
131 expect(list.span, isNullSpan(isNull)); 131 expect(list.span, isNullSpan(isNull));
(...skipping 22 matching lines...) Expand all
154 expect(span.length, equals(0)); 154 expect(span.length, equals(0));
155 expect(span.text, isEmpty); 155 expect(span.text, isEmpty);
156 expect(span.isIdentifier, isFalse); 156 expect(span.isIdentifier, isFalse);
157 expect(span.start, equals(span.end)); 157 expect(span.start, equals(span.end));
158 expect(span.start.offset, equals(0)); 158 expect(span.start.offset, equals(0));
159 expect(span.start.line, equals(0)); 159 expect(span.start.line, equals(0));
160 expect(span.start.column, equals(0)); 160 expect(span.start.column, equals(0));
161 expect(span.sourceUrl, sourceUrl); 161 expect(span.sourceUrl, sourceUrl);
162 return true; 162 return true;
163 }); 163 });
OLDNEW
« no previous file with comments | « pkg/yaml/pubspec.yaml ('k') | sdk/lib/_internal/pub/lib/src/barback/transformer_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698