@@ -1804,70 +1804,66 @@ void main() {
1804
1804
});
1805
1805
1806
1806
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
+ });
1825
1814
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
+ });
1837
1822
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
+ });
1853
1831
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
+ });
1871
1867
});
1872
1868
1873
1869
group ('10.3: Core Schema' , () {
0 commit comments