From ee3677ea8dac6f818332f6d31b7ddb4bb3149971 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Wed, 10 May 2023 04:11:32 +0000 Subject: [PATCH] Uncomment some tests 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. https://github.com/dart-lang/test/issues/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. --- CHANGELOG.md | 2 + pubspec.yaml | 2 +- test/yaml_test.dart | 118 +++++++++++++++++++++----------------------- 3 files changed, 60 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a78ef9..69a6c9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 3.1.3-wip + ## 3.1.2 * Require Dart 2.19 diff --git a/pubspec.yaml b/pubspec.yaml index a3290e1..1671b26 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: yaml -version: 3.1.2 +version: 3.1.3-wip description: A parser for YAML, a human-friendly data serialization standard repository: https://github.com/dart-lang/yaml topics: diff --git a/test/yaml_test.dart b/test/yaml_test.dart index d226924..bb35ba4 100644 --- a/test/yaml_test.dart +++ b/test/yaml_test.dart @@ -1804,70 +1804,66 @@ void main() { }); group('10.2: JSON Schema', () { - // test('[Example 10.4]', () { - // var doc = deepEqualsMap({"key with null value": null}); - // doc[null] = "value for null key"; - // expectYamlStreamLoads(doc, - // """ - // !!null null: value for null key - // key with null value: !!null null"""); - // }); - - // test('[Example 10.5]', () { - // expectYamlStreamLoads({ - // "YAML is a superset of JSON": true, - // "Pluto is a planet": false - // }, - // """ - // YAML is a superset of JSON: !!bool true - // Pluto is a planet: !!bool false"""); - // }); + test('[Example 10.4]', () { + var doc = deepEqualsMap({'key with null value': null}); + doc[null] = 'value for null key'; + expectYamlStreamLoads([doc], ''' + !!null null: value for null key + key with null value: !!null null'''); + }); - // test('[Example 10.6]', () { - // expectYamlStreamLoads({ - // "negative": -12, - // "zero": 0, - // "positive": 34 - // }, - // """ - // negative: !!int -12 - // zero: !!int 0 - // positive: !!int 34"""); - // }); + test('[Example 10.5]', () { + expectYamlStreamLoads([ + {'YAML is a superset of JSON': true, 'Pluto is a planet': false} + ], ''' + YAML is a superset of JSON: !!bool true + Pluto is a planet: !!bool false'''); + }); - // test('[Example 10.7]', () { - // expectYamlStreamLoads({ - // "negative": -1, - // "zero": 0, - // "positive": 23000, - // "infinity": infinity, - // "not a number": nan - // }, - // """ - // negative: !!float -1 - // zero: !!float 0 - // positive: !!float 2.3e4 - // infinity: !!float .inf - // not a number: !!float .nan"""); - // }); + test('[Example 10.6]', () { + expectYamlStreamLoads([ + {'negative': -12, 'zero': 0, 'positive': 34} + ], ''' + negative: !!int -12 + zero: !!int 0 + positive: !!int 34'''); + }); - // test('[Example 10.8]', () { - // expectYamlStreamLoads({ - // "A null": null, - // "Booleans": [true, false], - // "Integers": [0, -0, 3, -19], - // "Floats": [0, 0, 12000, -200000], - // // Despite being invalid in the JSON schema, these values are valid in - // // the core schema which this implementation supports. - // "Invalid": [ true, null, 7, 0x3A, 12.3] - // }, - // """ - // A null: null - // Booleans: [ true, false ] - // Integers: [ 0, -0, 3, -19 ] - // Floats: [ 0., -0.0, 12e03, -2E+05 ] - // Invalid: [ True, Null, 0o7, 0x3A, +12.3 ]"""); - // }); + test('[Example 10.7]', () { + expectYamlStreamLoads([ + { + 'negative': -1, + 'zero': 0, + 'positive': 23000, + 'infinity': infinity, + 'not a number': nan + } + ], ''' + negative: !!float -1 + zero: !!float 0 + positive: !!float 2.3e4 + infinity: !!float .inf + not a number: !!float .nan'''); + }, skip: 'Fails for single digit float'); + + test('[Example 10.8]', () { + expectYamlStreamLoads([ + { + 'A null': null, + 'Booleans': [true, false], + 'Integers': [0, -0, 3, -19], + 'Floats': [0, 0, 12000, -200000], + // Despite being invalid in the JSON schema, these values are valid in + // the core schema which this implementation supports. + 'Invalid': [true, null, 7, 0x3A, 12.3] + } + ], ''' + A null: null + Booleans: [ true, false ] + Integers: [ 0, -0, 3, -19 ] + Floats: [ 0., -0.0, 12e03, -2E+05 ] + Invalid: [ True, Null, 0o7, 0x3A, +12.3 ]'''); + }); }); group('10.3: Core Schema', () {