Skip to content

Commit

Permalink
Moved some setup into a method
Browse files Browse the repository at this point in the history
  • Loading branch information
dafrito committed Jul 20, 2010
1 parent a220013 commit bdc0ac4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/com/dafrito/lua/script/LuaTableTest.java
Expand Up @@ -4,20 +4,27 @@
import lua.LuaLibrary;
import lua.LuaLibrary.lua_State;

import org.junit.Before;
import org.junit.Test;

public class LuaTableTest {
LuaLibrary lua = LuaLibrary.INSTANCE;
private LuaBindings b;
private LuaScriptContext ctx;

@Test
public void getAndPutAValueIntoATable() throws Exception {
LuaScriptContext ctx = new LuaScriptContext();
LuaBindings b = ctx.getGlobals();
lua.lua_createtable(b.getState(), 0, 0);
LuaTable t = new LuaTable(new LuaReference(b));
t.set(1, "No time");
assertEquals("No time", t.get(1));
}

@Before
public void setup() {
ctx = new LuaScriptContext();
b = ctx.getGlobals();
}

class LuaTable {
private LuaBindings b;
Expand Down

0 comments on commit bdc0ac4

Please sign in to comment.