Add tests for parseAt with null values (dart-lang/yaml_edit#110)
diff --git a/pkgs/yaml_edit/test/parse_test.dart b/pkgs/yaml_edit/test/parse_test.dart index d363090..ea2ae57 100644 --- a/pkgs/yaml_edit/test/parse_test.dart +++ b/pkgs/yaml_edit/test/parse_test.dart
@@ -100,7 +100,7 @@ test('with the correct value in nested collection', () { final doc = YamlEditor(''' a: 1 -b: +b: d: 4 e: [5, 6, 7] c: 3 @@ -109,6 +109,15 @@ expect(doc.parseAt(['b', 'e', 2]).value, 7); }); + test('with a null value in nested collection', () { + final doc = YamlEditor(''' +key1: + key2: null +'''); + + expect(doc.parseAt(['key1', 'key2']).value, null); + }); + test('with the correct type (2)', () { final doc = YamlEditor("YAML: YAML Ain't Markup Language"); final expectedYamlMap = doc.parseAt([]); @@ -144,4 +153,14 @@ ]).value, equals(4)); }); + + test('works with null in path', () { + final doc = YamlEditor('{a: { ~: 4}}'); + expect(doc.parseAt(['a', null]).value, equals(4)); + }); + + test('works with null value', () { + final doc = YamlEditor('{a: null}'); + expect(doc.parseAt(['a']).value, equals(null)); + }); }