added test for "php closures from lua" functionality

This commit is contained in:
Harald Lapp
2013-08-26 15:40:25 +02:00
parent f6c6a7fb9e
commit 96ad976776

30
tests/013.phpt Normal file
View File

@@ -0,0 +1,30 @@
--TEST--
PHP Closures from Lua
--SKIPIF--
<?php if (!extension_loaded("lua")) print "skip"; ?>
--FILE--
<?php
$l = new lua();
$l->eval(<<<CODE
function test(cb1)
local cb2 = cb1("called from lua")
cb2("returned from php")
end
CODE
);
try {
$l->test(function($msg) {
print "$msg";
return function($msg) {
print "$msg";
};
});
} catch(LuaException $e) {
echo $e->getMessage();
}
?>
--EXPECTF--
called from luareturned from php