aboutsummaryrefslogtreecommitdiffstats
path: root/test/chaining_test.lua
diff options
context:
space:
mode:
authorGravatar BanceDev 2024-10-15 11:40:26 -0400
committerGravatar BanceDev 2024-10-15 11:40:26 -0400
commit6295ae273d4a15b60b580344b986986d004c22ad (patch)
treeea8eb39136ab6f128a5388ad656c0b899a91997d /test/chaining_test.lua
parentv0.2.3 (diff)
updated help messages
Diffstat (limited to 'test/chaining_test.lua')
-rw-r--r--test/chaining_test.lua24
1 files changed, 21 insertions, 3 deletions
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)