commit | 8a380e81cd9a0e0d72893df6be1eb61450a05032 | [log] [tgz] |
---|---|---|
author | Sigurd Meldgaard <sigurdm@google.com> | Thu Sep 28 15:05:42 2023 +0200 |
committer | GitHub <noreply@github.com> | Thu Sep 28 15:05:42 2023 +0200 |
tree | 55ebfa6cb6d0011c6f7e61669915564980ef345c | |
parent | 4a9734dda12f63ef9eee4121f87ff4401e25a607 [diff] |
Change AliasError to AliasException (#57)
A library for YAML manipulation while preserving comments.
A simple usage example:
import 'package:yaml_edit/yaml_edit.dart'; void main() { final yamlEditor = YamlEditor('{YAML: YAML}'); yamlEditor.update(['YAML'], "YAML Ain't Markup Language"); print(yamlEditor); // Expected output: // {YAML: YAML Ain't Markup Language} }
void main() { final jsonString = r''' { "key": "value", "list": [ "first", "second", "last entry in the list" ], "map": { "multiline": "this is a fairly long string with\nline breaks..." } } '''; final jsonValue = json.decode(jsonString); // Convert jsonValue to YAML final yamlEditor = YamlEditor(''); yamlEditor.update([], jsonValue); print(yamlEditor.toString()); }
Testing is done in two strategies: Unit testing (/test/editor_test.dart
) and Golden testing (/test/golden_test.dart
). More information on Golden testing and the input/output format can be found at /test/testdata/README.md
.
These tests are automatically run with pub run test
.