Skip to content

Commit 90aae5f

Browse files
committed
Extra unit tests for '-' lexer handling.
Added extra tests.
1 parent d51ae03 commit 90aae5f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/test/java/com/laytonsmith/core/MethodScriptCompilerTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,16 @@ public void testMinusSignHandling() throws Exception {
11541154
this.verifyExecute("msg(2- abs(5))", "-3");
11551155
this.verifyExecute("msg(2 -abs(5))", "-3");
11561156
this.verifyExecute("msg(2-abs(5))", "-3");
1157+
1158+
// "- something".
1159+
this.verifyExecute("msg(-5)", "-5");
1160+
this.verifyExecute("msg(typeof(-5))", "int");
1161+
this.verifyExecute("msg(- 5)", "-5");
1162+
this.verifyExecute("msg(typeof(- 5))", "int");
1163+
this.verifyExecute("@a = 5; msg(-@a)", "-5");
1164+
this.verifyExecute("@a = 5; msg(typeof(-@a))", "int");
1165+
this.verifyExecute("@a = 5; msg(- @a)", "-5");
1166+
this.verifyExecute("@a = 5; msg(typeof(- @a))", "int");
11571167
}
11581168

11591169
private void verifyExecute(String script, String expectedResponse) throws ConfigCompileException, ConfigCompileGroupException {

0 commit comments

Comments
 (0)