From 6e2fa9786ae20b670e77a72f1271d7574bc89f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tina=20M=C3=BCller=20=28tinita=29?= Date: Mon, 1 Jun 2020 11:55:55 +0200 Subject: Emitter: Output space after an alias mapping key (#185) Before: a: &b x *b: c Now: a: &b x *b : c Passing tests: * 26DV: Whitespace around colon in mappings * E76Z: Aliases in Implicit Block Mapping * X38W: Aliases in Flow Objects Test manually because `make test-suite` will overwrite changes in the skiplist: ./tests/run-parser-test-suite tests/run-test-suite/data/26DV/in.yaml | ./tests/run-emitter-test-suite ./tests/run-parser-test-suite tests/run-test-suite/data/E76Z/in.yaml | ./tests/run-emitter-test-suite ./tests/run-parser-test-suite tests/run-test-suite/data/X38W/in.yaml | ./tests/run-emitter-test-suite Or edit tests/run-test-suite/test/blacklist/libyaml-emitter and do: (cd tests/run-test-suite; prove -lv test) Also I added some newlines to yaml.h to help identifying states by number. --- src/emitter.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/emitter.c b/src/emitter.c index 7dd8331..656b3ad 100644 --- a/src/emitter.c +++ b/src/emitter.c @@ -1023,6 +1023,8 @@ yaml_emitter_emit_alias(yaml_emitter_t *emitter, SHIM(yaml_event_t *event)) { if (!yaml_emitter_process_anchor(emitter)) return 0; + if (emitter->simple_key_context) + if (!PUT(emitter, ' ')) return 0; emitter->state = POP(emitter, emitter->states); return 1; -- cgit v1.2.1