aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/recursive/build.lua7
-rw-r--r--tests/recursive/src/index.html15
-rw-r--r--tests/recursive/src/second.html15
-rw-r--r--tests/simple/build.lua8
-rw-r--r--tests/simple/test.py39
5 files changed, 84 insertions, 0 deletions
diff --git a/tests/recursive/build.lua b/tests/recursive/build.lua
new file mode 100644
index 0000000..37e1d8e
--- /dev/null
+++ b/tests/recursive/build.lua
@@ -0,0 +1,7 @@
+local template = Template:new()
+
+template:add_directory('./src', {
+ name = template:option('name')
+})
+
+return template
diff --git a/tests/recursive/src/index.html b/tests/recursive/src/index.html
new file mode 100644
index 0000000..38b1f0b
--- /dev/null
+++ b/tests/recursive/src/index.html
@@ -0,0 +1,15 @@
+<!DOCTYPE "html">
+<html>
+ <head>
+ <title>@{name()}</title>
+ </head>
+ <body>
+ @{function()
+ local text = ""
+ for i=1,10 do
+ text = text .. ' ' .. tostring(i)
+ end
+ return text
+ end}
+ </body>
+</html>
diff --git a/tests/recursive/src/second.html b/tests/recursive/src/second.html
new file mode 100644
index 0000000..e03a249
--- /dev/null
+++ b/tests/recursive/src/second.html
@@ -0,0 +1,15 @@
+<!DOCTYPE "html">
+<html>
+ <head>
+ <title>@{name()}</title>
+ </head>
+ <body>
+ @{function()
+ local text = ""
+ for i=1,50 do
+ text = text .. ' ' .. tostring(i)
+ end
+ return text
+ end}
+ </body>
+</html>
diff --git a/tests/simple/build.lua b/tests/simple/build.lua
new file mode 100644
index 0000000..996ccda
--- /dev/null
+++ b/tests/simple/build.lua
@@ -0,0 +1,8 @@
+local template = Template:new()
+
+template:add_file("./test.py", {
+ module = "a_module_that_is_different",
+ name = template:option('name')
+})
+
+return template
diff --git a/tests/simple/test.py b/tests/simple/test.py
new file mode 100644
index 0000000..20c1c7e
--- /dev/null
+++ b/tests/simple/test.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python3
+
+# This module is called @{name()}
+
+import @{module}
+
+print("@{function()
+ return "Hello World"
+end}")
+
+print("@{function()
+ local a = { "asdf", "1234" }
+ return a[1]
+end}")
+
+print(@{function()
+ local a = { "asdf", "1234" } -- {
+ return a[2]
+end})
+
+print("@{function()
+ local a = "asdf{asdf"
+ return a:sub(1)
+end}")
+
+print("@{function()
+ local a = "asdf"
+ --[[
+ some comment }
+ --]]
+ return a
+end}")
+
+print("@{function()
+ local a = [[
+ some comment }
+ ]]
+ return a:sub(2, 8)
+end}")