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

Side by Side Diff: utils/tests/pub/yaml_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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) 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_test; 5 library yaml_test;
6 6
7 import 'dart:math';
8
9 import '../../../pkg/unittest/lib/unittest.dart'; 7 import '../../../pkg/unittest/lib/unittest.dart';
10 import '../../pub/yaml/yaml.dart'; 8 import '../../pub/yaml/yaml.dart';
11 import '../../pub/yaml/deep_equals.dart'; 9 import '../../pub/yaml/deep_equals.dart';
12 import '../../../tests/utils/test_utils.dart'; 10 import '../../../tests/utils/test_utils.dart';
13 11
14 /// Constructs a new yaml.YamlMap, optionally from a normal Map. 12 /// Constructs a new yaml.YamlMap, optionally from a normal Map.
15 Map yamlMap([Map from]) => 13 Map yamlMap([Map from]) =>
16 from == null ? new YamlMap() : new YamlMap.from(from); 14 from == null ? new YamlMap() : new YamlMap.from(from);
17 15
18 /// Asserts that a string containing a single YAML document produces a given 16 /// Asserts that a string containing a single YAML document produces a given
19 /// value when loaded. 17 /// value when loaded.
20 expectYamlLoads(expected, String source) { 18 expectYamlLoads(expected, String source) {
21 var actual = loadYaml(cleanUpLiteral(source)); 19 var actual = loadYaml(cleanUpLiteral(source));
22 Expect.isTrue(deepEquals(expected, actual), 20 Expect.isTrue(deepEquals(expected, actual),
23 'expectYamlLoads(expected: <$expected>, actual: <$actual>)'); 21 'expectYamlLoads(expected: <$expected>, actual: <$actual>)');
24 } 22 }
25 23
26 /// Asserts that a string containing a stream of YAML documents produces a given 24 /// Asserts that a string containing a stream of YAML documents produces a given
27 /// list of values when loaded. 25 /// list of values when loaded.
28 expectYamlStreamLoads(List expected, String source) { 26 expectYamlStreamLoads(List expected, String source) {
29 var actual = loadYamlStream(cleanUpLiteral(source)); 27 var actual = loadYamlStream(cleanUpLiteral(source));
30 Expect.isTrue(deepEquals(expected, actual), 28 Expect.isTrue(deepEquals(expected, actual),
31 'expectYamlStreamLoads(expected: <$expected>, actual: <$actual>)'); 29 'expectYamlStreamLoads(expected: <$expected>, actual: <$actual>)');
32 } 30 }
33 31
34 main() { 32 main() {
35 var infinity = parseDouble("Infinity"); 33 var infinity = double.parse("Infinity");
36 var nan = parseDouble("NaN"); 34 var nan = double.parse("NaN");
37 35
38 group('YamlMap', () { 36 group('YamlMap', () {
39 group('accepts as a key', () { 37 group('accepts as a key', () {
40 _expectKeyWorks(keyFn()) { 38 _expectKeyWorks(keyFn()) {
41 var map = yamlMap(); 39 var map = yamlMap();
42 map[keyFn()] = 5; 40 map[keyFn()] = 5;
43 expect(map.containsKey(keyFn()), isTrue); 41 expect(map.containsKey(keyFn()), isTrue);
44 expect(map[keyFn()], 5); 42 expect(map[keyFn()], 5);
45 } 43 }
46 44
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1870 A null: null 1868 A null: null
1871 Also a null: # Empty 1869 Also a null: # Empty
1872 Not a null: "" 1870 Not a null: ""
1873 Booleans: [ true, True, false, FALSE ] 1871 Booleans: [ true, True, false, FALSE ]
1874 Integers: [ 0, 0o7, 0x3A, -19 ] 1872 Integers: [ 0, 0o7, 0x3A, -19 ]
1875 Floats: [ 0., -0.0, .5, +12e03, -2E+05 ] 1873 Floats: [ 0., -0.0, .5, +12e03, -2E+05 ]
1876 Also floats: [ .inf, -.Inf, +.INF, .NAN ]'''); 1874 Also floats: [ .inf, -.Inf, +.INF, .NAN ]''');
1877 }); 1875 });
1878 }); 1876 });
1879 } 1877 }
OLDNEW
« no previous file with comments | « utils/tests/pub/version_solver_test.dart ('k') | utils/tests/string_encoding/benchmark_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698