diff options
Diffstat (limited to 'test/test_threads_ex_arg.lua')
-rw-r--r-- | test/test_threads_ex_arg.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_threads_ex_arg.lua b/test/test_threads_ex_arg.lua new file mode 100644 index 0000000..44d3dd8 --- /dev/null +++ b/test/test_threads_ex_arg.lua | |||
@@ -0,0 +1,26 @@ | |||
1 | local thread_code = function(...) | ||
2 | local function assert_equal(name, a, b, ...) | ||
3 | if a == b then return b, ... end | ||
4 | print(name .. " Fail! Expected `" .. tostring(a) .. "` got `" .. tostring(b) .. "`") | ||
5 | os.exit(1) | ||
6 | end | ||
7 | |||
8 | local a,b,c,d,e,f = ... | ||
9 | assert_equal("1:", 1 , a ) | ||
10 | assert_equal("2:", nil , b ) | ||
11 | assert_equal("3:", 'hello' , c ) | ||
12 | assert_equal("4:", nil , d ) | ||
13 | assert_equal("5:", 2 , e ) | ||
14 | assert_equal("6:", nil , f ) | ||
15 | assert_equal("#:", 6 , select("#", ...)) | ||
16 | end | ||
17 | |||
18 | local llthreads = require"llthreads.ex" | ||
19 | |||
20 | local thread = llthreads.new(thread_code, 1, nil, 'hello', nil, 2, nil) | ||
21 | |||
22 | assert(thread:start()) | ||
23 | |||
24 | assert(thread:join()) | ||
25 | |||
26 | print("done!") \ No newline at end of file | ||