Files
php-lua/tests/print.phpt
Antony Dovgal ffae3062a4 add more tests
2019-05-24 12:42:01 +03:00

71 lines
693 B
PHP
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
--TEST--
test basic print() functionality
--SKIPIF--
<?php
if (!extension_loaded("lua")) print "skip lua extension missing";
?>
--FILE--
<?php
$lua = new Lua();
$lua->eval(<<<CODE
print (2+2)
CODE
);
$lua->eval(<<<CODE
x = 3
print (x)
CODE
);
$lua->eval(<<<CODE
print ("str")
CODE
);
$lua->eval(<<<CODE
x = "test\0test"
print (x)
CODE
);
$lua->eval(<<<CODE
print (nil)
CODE
);
$lua->eval(<<<CODE
print (nosuchvar)
CODE
);
$lua->eval(<<<CODE
print (true)
CODE
);
$lua->eval(<<<CODE
print (false)
CODE
);
$lua->eval(<<<CODE
foo = function () print("hello") end
print (foo)
CODE
);
$lua->eval(<<<CODE
x = true
print (x)
CODE
);
?>
--EXPECTF--
43strtesttest1LuaClosure Object
(
)
1