From 6295ae273d4a15b60b580344b986986d004c22ad Mon Sep 17 00:00:00 2001 From: BanceDev Date: Tue, 15 Oct 2024 11:40:26 -0400 Subject: updated help messages --- test/chaining_test.lua | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'test/chaining_test.lua') diff --git a/test/chaining_test.lua b/test/chaining_test.lua index 411dcdd..31ede87 100644 --- a/test/chaining_test.lua +++ b/test/chaining_test.lua @@ -15,7 +15,6 @@ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ]] --- TODO: Add more edge case tests for chaining operators local cwd = lush.getcwd() lush.cd("~/.lush/scripts") if lush.exec('cat "example.lua" | grep "hello" | sort | uniq') then @@ -53,18 +52,37 @@ else lush.exit() end -if lush.exec("echo hi > test.txt") then +if + lush.exec( + "echo hi > test.txt; echo hi 1> test.txt; echo this wont redirect 2> test.txt; echo but this will &> test.txt" + ) +then print("redirect test passed ✅\n") else print("redirect test failed ❌\n") lush.exit() end -if lush.exec("echo hi >> test.txt") then +if + lush.exec( + "echo hi >> test.txt; echo hi 1>> test.txt; echo this wont append 2>> test.txt; echo but this will &>> test.txt" + ) +then print("append test passed ✅\n") else print("append test failed ❌\n") lush.exit() end +if + lush.exec( + 'cat "example.lua" | grep "hello" | sort | uniq && echo hi >> test.txt; echo this should print && cd lol || echo lol doesnt exist &> test.txt' + ) +then + print("complex chain test passed ✅\n") +else + print("complex chain test failed ❌\n") + lush.exit() +end + lush.cd(cwd) -- cgit v1.2.3-59-g8ed1b