commit | 6abc42a74b76700ad02fa1c1ebd94951b62626b9 | [log] [tgz] |
---|---|---|
author | Devon Carew <devoncarew@google.com> | Wed Mar 08 03:44:56 2023 -0800 |
committer | GitHub <noreply@github.com> | Wed Mar 08 03:44:56 2023 -0800 |
tree | 0fd6396a99e2b03a478653f30a37e2bb9ecbb62a | |
parent | 48e5868b307b2a3619fc9aaf3e70c0c637c91b7e [diff] |
updates for the next version of package:yaml (#45)
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
.