aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cancel.lua2
-rw-r--r--tests/error.lua9
-rw-r--r--tests/finalizer.lua4
-rw-r--r--tests/tobeclosed.lua2
4 files changed, 12 insertions, 5 deletions
diff --git a/tests/cancel.lua b/tests/cancel.lua
index 8dfccd2..1984c85 100644
--- a/tests/cancel.lua
+++ b/tests/cancel.lua
@@ -72,7 +72,7 @@ local waitCancellation = function( h, expected_status)
72 until h.status ~= "running" 72 until h.status ~= "running"
73 end 73 end
74 print( "lane status:", h.status) 74 print( "lane status:", h.status)
75 assert( h.status == expected_status, h.status .. " ~= " .. expected_status) 75 assert( h.status == expected_status, "lane status " .. h.status .. " (actual) ~= " .. expected_status .. " (expected)")
76 print "test OK" 76 print "test OK"
77end 77end
78 78
diff --git a/tests/error.lua b/tests/error.lua
index 126161e..a1ba1ce 100644
--- a/tests/error.lua
+++ b/tests/error.lua
@@ -95,12 +95,12 @@ local make_table_error_mt = function()
95end 95end
96 96
97local lane_error_as_string = "'lane error as string'" 97local lane_error_as_string = "'lane error as string'"
98local lane_error_as_table = setmetatable({}, make_table_error_mt()) 98local lane_error_as_table = setmetatable({"lane error as table"}, make_table_error_mt())
99local lane_error_as_linda = lanes.linda("'lane error'") 99local lane_error_as_linda = lanes.linda("'lane error'")
100 100
101local finalizer_error_as_string = "'lane error as string'" 101local finalizer_error_as_string = "'finalizer error as string'"
102local finalizer_error_as_table = setmetatable({}, make_table_error_mt()) 102local finalizer_error_as_table = setmetatable({"finalizer error as table"}, make_table_error_mt())
103local finalizer_error_as_linda = lanes.linda("'lane error'") 103local finalizer_error_as_linda = lanes.linda("'finalizer error'")
104 104
105local test_settings = {} 105local test_settings = {}
106local configure_tests = function() 106local configure_tests = function()
@@ -150,6 +150,7 @@ local configure_tests = function()
150 end 150 end
151 end 151 end
152 end 152 end
153 WR "Tests configured"
153end 154end
154 155
155configure_tests() 156configure_tests()
diff --git a/tests/finalizer.lua b/tests/finalizer.lua
index 1412a67..8bf89b4 100644
--- a/tests/finalizer.lua
+++ b/tests/finalizer.lua
@@ -39,6 +39,7 @@ local function lane(error_)
39 error(error_, 0) -- exception here; the value needs NOT be a string 39 error(error_, 0) -- exception here; the value needs NOT be a string
40 end 40 end
41 -- no exception 41 -- no exception
42 io.stderr:write("Lane completed\n")
42 return true 43 return true
43end 44end
44 45
@@ -81,10 +82,13 @@ local do_test = function(error_)
81 assert(stack, "no stack trace on error, check 'error_trace_level'") 82 assert(stack, "no stack trace on error, check 'error_trace_level'")
82 io.stderr:write( "Lane error: "..tostring(err).."\n" ) 83 io.stderr:write( "Lane error: "..tostring(err).."\n" )
83 io.stderr:write( "\t", table.concat(stack,"\t\n"), "\n" ) 84 io.stderr:write( "\t", table.concat(stack,"\t\n"), "\n" )
85 else
86 io.stderr:write( "Done\n" )
84 end 87 end
85end 88end
86 89
87do_test(nil) 90do_test(nil)
91-- do return end
88do_test("An error") 92do_test("An error")
89 93
90local on_exit = function() 94local on_exit = function()
diff --git a/tests/tobeclosed.lua b/tests/tobeclosed.lua
index 5ac8ab7..7a5e3ae 100644
--- a/tests/tobeclosed.lua
+++ b/tests/tobeclosed.lua
@@ -83,6 +83,7 @@ do
83 local lane_body = function() 83 local lane_body = function()
84 WR "In lane body" 84 WR "In lane body"
85 lanes.sleep(1) 85 lanes.sleep(1)
86 return "success"
86 end 87 end
87 88
88 local h = lanes.gen("*", lane_body)() 89 local h = lanes.gen("*", lane_body)()
@@ -90,6 +91,7 @@ do
90 local tobeclosed <close> = h 91 local tobeclosed <close> = h
91 end 92 end
92 assert(h.status == "done") 93 assert(h.status == "done")
94 return "success"
93end 95end
94 96
95-- ################################################################################################# 97-- #################################################################################################