use of net.taken.redsnake.tree.Program in project redsnake by Taken0711.
the class IfTest method shouldExecuteElseBlockWhenExecutingIfWithoutParenthesisAndWithoutCurlyBracketsAndInline.
@Test
void shouldExecuteElseBlockWhenExecutingIfWithoutParenthesisAndWithoutCurlyBracketsAndInline() {
Program program = parseProgram("a = 0\n" + "if false a = 1 else a = 2");
program.execute(env);
assertEquals(new RedsInteger(2), env.getVariable("a"));
}
use of net.taken.redsnake.tree.Program in project redsnake by Taken0711.
the class IfTest method shouldExecuteThenBlockWhenExecutingIfWithParenthesisAndCurlyBracketsAndNotInline.
@Test
void shouldExecuteThenBlockWhenExecutingIfWithParenthesisAndCurlyBracketsAndNotInline() {
Program program = parseProgram("a = 0\n" + "if(true) {\n" + " a = 1\n" + "} else {\n" + " a = 2\n" + "}");
program.execute(env);
assertEquals(new RedsInteger(1), env.getVariable("a"));
}
Aggregations