OLD | NEW |
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 import 'package:test/test.dart'; | 5 import 'package:test/test.dart'; |
6 import 'package:yaml/yaml.dart'; | 6 import 'package:yaml/yaml.dart'; |
7 | 7 |
8 import 'utils.dart'; | 8 import 'utils.dart'; |
9 | 9 |
10 main() { | 10 main() { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 --- text | 50 --- text |
51 """); | 51 """); |
52 }); | 52 }); |
53 }); | 53 }); |
54 | 54 |
55 test("includes source span information", () { | 55 test("includes source span information", () { |
56 var yaml = loadYamlNode(r""" | 56 var yaml = loadYamlNode(r""" |
57 - foo: | 57 - foo: |
58 bar | 58 bar |
59 - 123 | 59 - 123 |
60 """); | 60 """) as YamlList; |
61 | 61 |
62 expect(yaml.span.start.line, equals(0)); | 62 expect(yaml.span.start.line, equals(0)); |
63 expect(yaml.span.start.column, equals(0)); | 63 expect(yaml.span.start.column, equals(0)); |
64 expect(yaml.span.end.line, equals(3)); | 64 expect(yaml.span.end.line, equals(3)); |
65 expect(yaml.span.end.column, equals(0)); | 65 expect(yaml.span.end.column, equals(0)); |
66 | 66 |
67 var map = yaml.nodes.first; | 67 var map = yaml.nodes.first as YamlMap; |
68 expect(map.span.start.line, equals(0)); | 68 expect(map.span.start.line, equals(0)); |
69 expect(map.span.start.column, equals(2)); | 69 expect(map.span.start.column, equals(2)); |
70 expect(map.span.end.line, equals(2)); | 70 expect(map.span.end.line, equals(2)); |
71 expect(map.span.end.column, equals(0)); | 71 expect(map.span.end.column, equals(0)); |
72 | 72 |
73 var key = map.nodes.keys.first; | 73 var key = map.nodes.keys.first; |
74 expect(key.span.start.line, equals(0)); | 74 expect(key.span.start.line, equals(0)); |
75 expect(key.span.start.column, equals(2)); | 75 expect(key.span.start.column, equals(2)); |
76 expect(key.span.end.line, equals(0)); | 76 expect(key.span.end.line, equals(0)); |
77 expect(key.span.end.column, equals(5)); | 77 expect(key.span.end.column, equals(5)); |
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 A null: null | 1874 A null: null |
1875 Also a null: # Empty | 1875 Also a null: # Empty |
1876 Not a null: "" | 1876 Not a null: "" |
1877 Booleans: [ true, True, false, FALSE ] | 1877 Booleans: [ true, True, false, FALSE ] |
1878 Integers: [ 0, 0o7, 0x3A, -19 ] | 1878 Integers: [ 0, 0o7, 0x3A, -19 ] |
1879 Floats: [ 0., -0.0, .5, +12e03, -2E+05 ] | 1879 Floats: [ 0., -0.0, .5, +12e03, -2E+05 ] |
1880 Also floats: [ .inf, -.Inf, +.INF, .NAN ]'''); | 1880 Also floats: [ .inf, -.Inf, +.INF, .NAN ]'''); |
1881 }); | 1881 }); |
1882 }); | 1882 }); |
1883 } | 1883 } |
OLD | NEW |