From e709a583f42079ea65552f713ecd66450bb7c92d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 4 Oct 2023 12:28:47 +0200 Subject: [PATCH] encoder_lua: Fix inclusion of pre-/suffix when prettyPrinted It seems certain operations like --prettyPrint or subset selections does not produce a DocumentNode, which is where the lua pre- and suffix was printed, causing those to be omitted. --- acceptance_tests/output-format.sh | 41 +++++++++++++++++++++++++++- pkg/yqlib/encoder_lua.go | 45 ++++++++++++++++++------------- 2 files changed, 66 insertions(+), 20 deletions(-) diff --git a/acceptance_tests/output-format.sh b/acceptance_tests/output-format.sh index 268185d4..4e9ad325 100755 --- a/acceptance_tests/output-format.sh +++ b/acceptance_tests/output-format.sh @@ -271,4 +271,43 @@ EOM assertEquals "$expected" "$X" } -source ./scripts/shunit2 \ No newline at end of file +testLuaOutputPretty() { + cat >test.yml <test.yml <