From 89d9c98af1ac352ba4d49d660e61b0853d6e1a86 Mon Sep 17 00:00:00 2001 From: Peter Drahoš Date: Fri, 1 Oct 2010 03:22:32 +0200 Subject: Import to git --- tests/require.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/require.lua (limited to 'tests/require.lua') 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 @@ +-- +-- REQUIRE.LUA +-- +-- Test that 'require' works from sublanes +-- +require 'lanes' + +local function a_lane() + -- To require 'math' we still actually need to have it initialized for + -- the lane. + -- + require "math" + assert( math and math.sqrt ) + assert( math.sqrt(4)==2 ) + + assert( lanes==nil ) + require "lanes" + assert( lanes and lanes.gen ) + + local h= lanes.gen( function() return 42 end ) () + local v= h[1] + + return v==42 +end + +local gen= lanes.gen( "math,package,string,table", a_lane ) + +local h= gen() +local ret= h[1] +assert( ret==true ) -- cgit v1.2.3-55-g6feb