Skip to content

Commit

Permalink
moar test for #27
Browse files Browse the repository at this point in the history
  • Loading branch information
turpid-monkey committed Dec 11, 2015
1 parent 37fdca5 commit b724553
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/java/edu/gcsc/lua/LuaSyntaxAnalyzerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,4 +552,28 @@ public void nestedTableFunctionDef() throws Exception
LuaSyntaxAnalyzer an = createAndRunTestAnalyzer(script, CaretInfo.HOME);
assertEquals("FUNCTION:problem.foo2; VARIABLE:problem; VARIABLE:problem.foo;", toString(an.getCompletions()));
}

@Test
public void doubleNestedTableFunctionDef() throws Exception
{
String script = "problem = { bar = { foo = function(a,b) return a+b end }}";
LuaSyntaxAnalyzer an = createAndRunTestAnalyzer(script, CaretInfo.HOME);
assertEquals("FUNCTION:problem.bar.foo2; VARIABLE:problem; VARIABLE:problem.bar; VARIABLE:problem.bar.foo;", toString(an.getCompletions()));
}

@Test
public void doubleNestedTableFunctionDef2() throws Exception
{
String script = "problem = { bar = { boo = 1, foo = function(a,b) return a+b end }}";
LuaSyntaxAnalyzer an = createAndRunTestAnalyzer(script, CaretInfo.HOME);
assertEquals("FUNCTION:problem.bar.foo2; VARIABLE:problem; VARIABLE:problem.bar; VARIABLE:problem.bar.boo; VARIABLE:problem.bar.foo;", toString(an.getCompletions()));
}

@Test
public void doubleNestedTableFunctionDef3() throws Exception
{
String script = "problem = { foo = function(a,b) return a+b end, boo = 1}";
LuaSyntaxAnalyzer an = createAndRunTestAnalyzer(script, CaretInfo.HOME);
assertEquals("FUNCTION:problem.foo2; VARIABLE:problem; VARIABLE:problem.boo; VARIABLE:problem.foo;", toString(an.getCompletions()));
}
}

0 comments on commit b724553

Please sign in to comment.