From 7c78a15b235b817f3895e707b95928417fd832da Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 12 Oct 2023 02:25:26 +0200 Subject: [PATCH] Lua output fixes (#1811) * encoder_lua: Handle explicitly positive infinity * 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. * encoder_lua: Improve Tag handling robustness Using the method call seems more reliable in case the input parser forgets to set the tag. --- acceptance_tests/output-format.sh | 41 +++++++++++++++++++++++++- pkg/yqlib/doc/usage/lua.md | 4 +++ pkg/yqlib/encoder_lua.go | 49 ++++++++++++++++++------------- pkg/yqlib/lua_test.go | 4 +++ 4 files changed, 76 insertions(+), 22 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 <