* Tests the load functions
*/
public void testLoadRun() throws Exception
{
// test loadfile
LuaState L = LuaStateFactory.newLuaState();
L.openLibs();
int loadRes = L.LloadFile("wrongLuaFile.lua");
assertEquals(loadRes, LuaState.LUA_ERRSYNTAX.intValue());
System.out.println(L.toString(-1));
L.pop(1);
loadRes = L.LloadFile("simpleLuaFile.lua");
assertEquals(loadRes, 0);
L.pcall(0, 0, 0);
// test loadbuffer
FileInputStream input = new FileInputStream("wrongLuaFile.lua");
byte[] bytes = new byte[input.available()];
input.read(bytes);
input.close();
loadRes = L.LloadBuffer(bytes, "test");
assertEquals(LuaState.LUA_ERRSYNTAX.intValue(), loadRes);
System.out.println(L.toString(-1));
input = new FileInputStream("simpleLuaFile.lua");
bytes = new byte[input.available()];
input.read(bytes);
input.close();
loadRes = L.LloadBuffer(bytes, "test2");
assertEquals(0, loadRes);
L.pcall(0, 0, 0);
L.close();
}