Skip to content

Commit 11a1044

Browse files
committed
Assert loader prints directive warnings in tests
1 parent c02e836 commit 11a1044

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

pkgs/yaml/test/yaml_test.dart

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -993,21 +993,33 @@ void main() {
993993
});
994994

995995
group('6.8: Directives', () {
996-
// TODO(nweiz): assert that this produces a warning
997996
test('[Example 6.13]', () {
998-
expectYamlLoads('foo', '''
997+
expect(
998+
() => expectYamlLoads(
999+
'foo',
1000+
'''
9991001
%FOO bar baz # Should be ignored
10001002
# with a warning.
1001-
--- "foo"''');
1003+
--- "foo"''',
1004+
),
1005+
prints(contains('Warning: unknown directive')),
1006+
);
10021007
});
10031008

1004-
// TODO(nweiz): assert that this produces a warning.
10051009
test('[Example 6.14]', () {
1006-
expectYamlLoads('foo', '''
1010+
expect(
1011+
() => expectYamlLoads(
1012+
'foo',
1013+
'''
10071014
%YAML 1.3 # Attempt parsing
10081015
# with a warning
10091016
---
1010-
"foo"''');
1017+
"foo"''',
1018+
),
1019+
prints(
1020+
contains('Warning: this parser only supports YAML 1.1 and 1.2.'),
1021+
),
1022+
);
10111023
});
10121024

10131025
test('[Example 6.15]', () {

0 commit comments

Comments
 (0)