From ddd8de4d6780af219ee80a674c8dd86468a6009a Mon Sep 17 00:00:00 2001 From: Sam Roxanne Date: Fri, 25 Jun 2021 10:27:52 -0500 Subject: [PATCH] tests, fixed a major bug i didn't catch before --- tests/bad_span.lua | 3 +++ tests/escape_hell.lua | 1 + tests/lua_test.lua | 3 +++ tests/noblockclose.lua | 2 ++ tests/nonewline_directive.lua | 2 ++ tests/nopreproc.lua | 1 + tests/runtests.sh | 5 +++++ tests/shell.lua | 6 ++++++ 8 files changed, 23 insertions(+) create mode 100644 tests/bad_span.lua create mode 100644 tests/escape_hell.lua create mode 100644 tests/lua_test.lua create mode 100644 tests/noblockclose.lua create mode 100644 tests/nonewline_directive.lua create mode 100644 tests/nopreproc.lua create mode 100755 tests/runtests.sh create mode 100644 tests/shell.lua diff --git a/tests/bad_span.lua b/tests/bad_span.lua new file mode 100644 index 0000000..2fd0c03 --- /dev/null +++ b/tests/bad_span.lua @@ -0,0 +1,3 @@ +@[{ + fuck +}] \ No newline at end of file diff --git a/tests/escape_hell.lua b/tests/escape_hell.lua new file mode 100644 index 0000000..5181676 --- /dev/null +++ b/tests/escape_hell.lua @@ -0,0 +1 @@ +--#error "fuck\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" \ No newline at end of file diff --git a/tests/lua_test.lua b/tests/lua_test.lua new file mode 100644 index 0000000..fcad6ee --- /dev/null +++ b/tests/lua_test.lua @@ -0,0 +1,3 @@ +@[[for i=1, 10 do]] + print("hello @[{i}]") +@[[end]] \ No newline at end of file diff --git a/tests/noblockclose.lua b/tests/noblockclose.lua new file mode 100644 index 0000000..7ab72fe --- /dev/null +++ b/tests/noblockclose.lua @@ -0,0 +1,2 @@ +@[[ +lmao \ No newline at end of file diff --git a/tests/nonewline_directive.lua b/tests/nonewline_directive.lua new file mode 100644 index 0000000..5c8ab75 --- /dev/null +++ b/tests/nonewline_directive.lua @@ -0,0 +1,2 @@ +-- include file +--#include "nopreproc.lua" \ No newline at end of file diff --git a/tests/nopreproc.lua b/tests/nopreproc.lua new file mode 100644 index 0000000..66632ea --- /dev/null +++ b/tests/nopreproc.lua @@ -0,0 +1 @@ +print("test") \ No newline at end of file diff --git a/tests/runtests.sh b/tests/runtests.sh new file mode 100755 index 0000000..b68193e --- /dev/null +++ b/tests/runtests.sh @@ -0,0 +1,5 @@ +for test in $(find -name "*.lua"); do + echo "Running test $test" + luacomp $test > $test.out + echo "==============================================================" +done \ No newline at end of file diff --git a/tests/shell.lua b/tests/shell.lua new file mode 100644 index 0000000..c4d5ed2 --- /dev/null +++ b/tests/shell.lua @@ -0,0 +1,6 @@ +-- raw evar +print("your shell is $[{SHELL}]") +-- evar string +print("your shell is "..$(SHELL)) +-- cat +$[[cat nopreproc.lua]]