summaryrefslogtreecommitdiff
path: root/tests/require.lua
diff options
context:
space:
mode:
authorPeter Drahoš <drahosp@gmail.com>2010-10-01 03:22:32 +0200
committerPeter Drahoš <drahosp@gmail.com>2010-10-01 03:22:32 +0200
commit89d9c98af1ac352ba4d49d660e61b0853d6e1a86 (patch)
tree15c56d2ce66b4ab147171c0f674cdb4a435ff13f /tests/require.lua
downloadlanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.tar.gz
lanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.tar.bz2
lanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.zip
Import to git
Diffstat (limited to 'tests/require.lua')
-rw-r--r--tests/require.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/require.lua b/tests/require.lua
new file mode 100644
index 0000000..2cfe780
--- /dev/null
+++ b/tests/require.lua
@@ -0,0 +1,30 @@
1--
2-- REQUIRE.LUA
3--
4-- Test that 'require' works from sublanes
5--
6require 'lanes'
7
8local function a_lane()
9 -- To require 'math' we still actually need to have it initialized for
10 -- the lane.
11 --
12 require "math"
13 assert( math and math.sqrt )
14 assert( math.sqrt(4)==2 )
15
16 assert( lanes==nil )
17 require "lanes"
18 assert( lanes and lanes.gen )
19
20 local h= lanes.gen( function() return 42 end ) ()
21 local v= h[1]
22
23 return v==42
24end
25
26local gen= lanes.gen( "math,package,string,table", a_lane )
27
28local h= gen()
29local ret= h[1]
30assert( ret==true )