aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGravatar BanceDev 2024-09-27 09:33:01 -0400
committerGravatar BanceDev 2024-09-27 09:33:01 -0400
commit68ce253ca289030922581b10a34094750c34d729 (patch)
tree24a8d2a158794a0e42b5a154d3cf595188bd7227 /test
parentfixed chaining execution attempting to execute operator (diff)
added exit api function
Diffstat (limited to 'test')
-rw-r--r--test/args_test.lua2
-rw-r--r--test/chaining_test.lua8
-rw-r--r--test/env_test.lua2
-rw-r--r--test/filecheck_test.lua5
-rw-r--r--test/history_test.lua3
-rw-r--r--test/run_tests.lua1
6 files changed, 20 insertions, 1 deletions
diff --git a/test/args_test.lua b/test/args_test.lua
index d14fd73..a698b36 100644
--- a/test/args_test.lua
+++ b/test/args_test.lua
@@ -17,7 +17,7 @@ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
if args == nil then
print("args test failed, no args found ❌\n")
- return
+ lush.exit()
else
print("args:")
for i = 1, #args do
diff --git a/test/chaining_test.lua b/test/chaining_test.lua
index 83f3e76..411dcdd 100644
--- a/test/chaining_test.lua
+++ b/test/chaining_test.lua
@@ -15,48 +15,56 @@ 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
print("piping test passed ✅\n")
else
print("piping test failed ❌\n")
+ lush.exit()
end
if lush.exec("echo hi && echo bye") then
print("and test passed ✅\n")
else
print("and test failed ❌\n")
+ lush.exit()
end
if lush.exec("cd lol || echo lol does not exist") then
print("or test passed ✅\n")
else
print("or test failed ❌\n")
+ lush.exit()
end
if lush.exec("sleep 2 &") then
print("background test passed ✅\n")
else
print("background test failed ❌\n")
+ lush.exit()
end
if lush.exec("echo hi; echo bye") then
print("semicolon test passed ✅\n")
else
print("semicolon test failed ❌\n")
+ lush.exit()
end
if lush.exec("echo hi > 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
print("append test passed ✅\n")
else
print("append test failed ❌\n")
+ lush.exit()
end
lush.cd(cwd)
diff --git a/test/env_test.lua b/test/env_test.lua
index 972a730..4a0d9d2 100644
--- a/test/env_test.lua
+++ b/test/env_test.lua
@@ -20,6 +20,7 @@ if lush.getenv("ENVTEST") == "envtest" then
print("setenv test passed ✅\n")
else
print("setenv test failed ❌\n")
+ lush.exit()
end
lush.unsetenv("ENVTEST")
@@ -27,4 +28,5 @@ if lush.getenv("ENVTEST") == nil then
print("unsetenv test passed ✅\n")
else
print("unsetenv test failed ❌\n")
+ lush.exit()
end
diff --git a/test/filecheck_test.lua b/test/filecheck_test.lua
index af0c130..9a2ffd7 100644
--- a/test/filecheck_test.lua
+++ b/test/filecheck_test.lua
@@ -19,28 +19,33 @@ if lush.exists("~/.lush/scripts/example.lua") then
print("exists test passed ✅\n")
else
print("exists test failed ❌\n")
+ lush.exit()
end
if lush.isFile("~/.lush/scripts/example.lua") then
print("isFile test passed ✅\n")
else
print("isFile test failed ❌\n")
+ lush.exit()
end
if not lush.isDirectory("~/.lush/scripts/example.lua") then
print("isDirectory test passed ✅\n")
else
print("isDirectory test failed ❌\n")
+ lush.exit()
end
if lush.isReadable("~/.lush/scripts/example.lua") then
print("isReadable test passed ✅\n")
else
print("isReadable test failed ❌\n")
+ lush.exit()
end
if lush.isWriteable("~/.lush/scripts/example.lua") then
print("isWriteable test passed ✅\n")
else
print("isWriteable test failed ❌\n")
+ lush.exit()
end
diff --git a/test/history_test.lua b/test/history_test.lua
index 69d8287..50be957 100644
--- a/test/history_test.lua
+++ b/test/history_test.lua
@@ -29,10 +29,13 @@ if lush.getHistory(1) == lush.lastHistory() then
print("getHistory test passed ✅\n")
else
print("getHistory test failed at args history ❌\n")
+ lush.exit()
end
else
print("getHistory test failed at piping history ❌\n")
+ lush.exit()
end
else
print("getHistory test failed at lastHistory ❌\n")
+ lush.exit()
end
diff --git a/test/run_tests.lua b/test/run_tests.lua
index 6c54157..39749d3 100644
--- a/test/run_tests.lua
+++ b/test/run_tests.lua
@@ -15,6 +15,7 @@ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
]]
+-- TODO: Add API method for asserting command output equals some string
print("Starting Lunar Shell End-to-End Testing...\n")
print("Entering Debug Mode...")
lush.debug(true)