Skip to content

Commit

Permalink
Uncomment some tests (#145)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
natebosch authored May 10, 2023
1 parent 1f39ffe commit af3d8cd
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 62 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## 3.1.3-wip

## 3.1.2

* Require Dart 2.19
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
118 changes: 57 additions & 61 deletions test/yaml_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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', () {
Expand Down

0 comments on commit af3d8cd

Please sign in to comment.