summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEmil Renner Berthing <esmil@mailme.dk>2012-07-31 18:29:52 +0200
committerEmil Renner Berthing <esmil@mailme.dk>2012-07-31 18:47:58 +0200
commit526c253d57b2daed8a122d56a0532dc1e7e83b40 (patch)
tree40931fb575b078caec04fa4ec204861436698914 /test
parent9db0a1b8d4539fe5f7aa678e0ef8fb634fb48bf7 (diff)
downloadlem-526c253d57b2daed8a122d56a0532dc1e7e83b40.tar.gz
lem-526c253d57b2daed8a122d56a0532dc1e7e83b40.tar.xz
lem-526c253d57b2daed8a122d56a0532dc1e7e83b40.zip
utils: remove timer function
Diffstat (limited to 'test')
-rwxr-xr-xtest/test.lua9
-rwxr-xr-xtest/test2.lua16
2 files changed, 18 insertions, 7 deletions
diff --git a/test/test.lua b/test/test.lua
index 57d76f2..8402e05 100755
--- a/test/test.lua
+++ b/test/test.lua
@@ -23,11 +23,18 @@ local function sleep(n)
utils.sleeper():sleep(n)
end
+local function timer(n, f, ...)
+ utils.spawn(function(...)
+ sleep(n)
+ return f(...)
+ end, ...)
+end
+
--print('package.cpath = ', package.cpath)
print 'Saying booh in 2.5 seconds'
-utils.timer(2.5, function() print 'Booh!' end)
+timer(2.5, function() print 'Booh!' end)
print 'Sleeping 5 seconds'
diff --git a/test/test2.lua b/test/test2.lua
index b64eedf..4988a0b 100755
--- a/test/test2.lua
+++ b/test/test2.lua
@@ -26,15 +26,19 @@ local function sleep(n)
end
print 'Saying "Fee!" in 1 second'
-utils.timer(1, function() print 'Fee!' end)
+utils.spawn(function()
+ sleep(1)
+ print 'Fee!'
+end)
print 'Saying "Fo!" in 3 seconds'
-utils.timer(3, function() print 'Fo!' end)
-
utils.spawn(function()
- print 'Sleeping for 2 seconds, then saying "Fi!" before the script ends'
- sleep(2)
- print 'Fi!'
+ sleep(3)
+ print 'Fo!'
end)
+print 'Sleeping for 2 seconds, then saying "Fi!" before the script ends'
+sleep(2)
+print 'Fi!'
+
-- vim: syntax=lua ts=3 sw=3 et: