Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit af3d8cd

Browse files
authored
Uncomment some tests (#145)
These tests had been commented out since the original commit in this repo even though most of them would pass. With these tests commented out the suite has an empty `group` which may become disallowed. dart-lang/test#1961 Change double quotes to single quotes. Skip a test which is currently failing due to an error parsing a float value with a single digit.
1 parent 1f39ffe commit af3d8cd

File tree

3 files changed

+60
-62
lines changed

3 files changed

+60
-62
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 3.1.3-wip
2+
13
## 3.1.2
24

35
* Require Dart 2.19

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: yaml
2-
version: 3.1.2
2+
version: 3.1.3-wip
33
description: A parser for YAML, a human-friendly data serialization standard
44
repository: https://github.com/dart-lang/yaml
55
topics:

test/yaml_test.dart

Lines changed: 57 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,70 +1804,66 @@ void main() {
18041804
});
18051805

18061806
group('10.2: JSON Schema', () {
1807-
// test('[Example 10.4]', () {
1808-
// var doc = deepEqualsMap({"key with null value": null});
1809-
// doc[null] = "value for null key";
1810-
// expectYamlStreamLoads(doc,
1811-
// """
1812-
// !!null null: value for null key
1813-
// key with null value: !!null null""");
1814-
// });
1815-
1816-
// test('[Example 10.5]', () {
1817-
// expectYamlStreamLoads({
1818-
// "YAML is a superset of JSON": true,
1819-
// "Pluto is a planet": false
1820-
// },
1821-
// """
1822-
// YAML is a superset of JSON: !!bool true
1823-
// Pluto is a planet: !!bool false""");
1824-
// });
1807+
test('[Example 10.4]', () {
1808+
var doc = deepEqualsMap({'key with null value': null});
1809+
doc[null] = 'value for null key';
1810+
expectYamlStreamLoads([doc], '''
1811+
!!null null: value for null key
1812+
key with null value: !!null null''');
1813+
});
18251814

1826-
// test('[Example 10.6]', () {
1827-
// expectYamlStreamLoads({
1828-
// "negative": -12,
1829-
// "zero": 0,
1830-
// "positive": 34
1831-
// },
1832-
// """
1833-
// negative: !!int -12
1834-
// zero: !!int 0
1835-
// positive: !!int 34""");
1836-
// });
1815+
test('[Example 10.5]', () {
1816+
expectYamlStreamLoads([
1817+
{'YAML is a superset of JSON': true, 'Pluto is a planet': false}
1818+
], '''
1819+
YAML is a superset of JSON: !!bool true
1820+
Pluto is a planet: !!bool false''');
1821+
});
18371822

1838-
// test('[Example 10.7]', () {
1839-
// expectYamlStreamLoads({
1840-
// "negative": -1,
1841-
// "zero": 0,
1842-
// "positive": 23000,
1843-
// "infinity": infinity,
1844-
// "not a number": nan
1845-
// },
1846-
// """
1847-
// negative: !!float -1
1848-
// zero: !!float 0
1849-
// positive: !!float 2.3e4
1850-
// infinity: !!float .inf
1851-
// not a number: !!float .nan""");
1852-
// });
1823+
test('[Example 10.6]', () {
1824+
expectYamlStreamLoads([
1825+
{'negative': -12, 'zero': 0, 'positive': 34}
1826+
], '''
1827+
negative: !!int -12
1828+
zero: !!int 0
1829+
positive: !!int 34''');
1830+
});
18531831

1854-
// test('[Example 10.8]', () {
1855-
// expectYamlStreamLoads({
1856-
// "A null": null,
1857-
// "Booleans": [true, false],
1858-
// "Integers": [0, -0, 3, -19],
1859-
// "Floats": [0, 0, 12000, -200000],
1860-
// // Despite being invalid in the JSON schema, these values are valid in
1861-
// // the core schema which this implementation supports.
1862-
// "Invalid": [ true, null, 7, 0x3A, 12.3]
1863-
// },
1864-
// """
1865-
// A null: null
1866-
// Booleans: [ true, false ]
1867-
// Integers: [ 0, -0, 3, -19 ]
1868-
// Floats: [ 0., -0.0, 12e03, -2E+05 ]
1869-
// Invalid: [ True, Null, 0o7, 0x3A, +12.3 ]""");
1870-
// });
1832+
test('[Example 10.7]', () {
1833+
expectYamlStreamLoads([
1834+
{
1835+
'negative': -1,
1836+
'zero': 0,
1837+
'positive': 23000,
1838+
'infinity': infinity,
1839+
'not a number': nan
1840+
}
1841+
], '''
1842+
negative: !!float -1
1843+
zero: !!float 0
1844+
positive: !!float 2.3e4
1845+
infinity: !!float .inf
1846+
not a number: !!float .nan''');
1847+
}, skip: 'Fails for single digit float');
1848+
1849+
test('[Example 10.8]', () {
1850+
expectYamlStreamLoads([
1851+
{
1852+
'A null': null,
1853+
'Booleans': [true, false],
1854+
'Integers': [0, -0, 3, -19],
1855+
'Floats': [0, 0, 12000, -200000],
1856+
// Despite being invalid in the JSON schema, these values are valid in
1857+
// the core schema which this implementation supports.
1858+
'Invalid': [true, null, 7, 0x3A, 12.3]
1859+
}
1860+
], '''
1861+
A null: null
1862+
Booleans: [ true, false ]
1863+
Integers: [ 0, -0, 3, -19 ]
1864+
Floats: [ 0., -0.0, 12e03, -2E+05 ]
1865+
Invalid: [ True, Null, 0o7, 0x3A, +12.3 ]''');
1866+
});
18711867
});
18721868

18731869
group('10.3: Core Schema', () {

0 commit comments

Comments
 (0)