Skip to content

Commit 20a0eef

Browse files
committed
test that chacks that Class methods used directly through Java are still case sensitive
1 parent f8af049 commit 20a0eef

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/test/java/com/scriptbasic/testprograms/TestPrograms.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private static void codeTest(final String fileName, final Map<String, Object> ma
3131
}
3232

3333
private static void codeTest(final String fileName, final String expectedOutput)
34-
throws Exception {
34+
throws Exception {
3535
codeTest(fileName, null, expectedOutput);
3636
}
3737

@@ -98,6 +98,7 @@ public void testPrograms() throws Exception {
9898
codeTest("MethodCaseInsensitive.bas", "variable g: 0.8");
9999

100100
testSyntaxFail("ErrorTestSub1.bas");
101+
testRuntimeFail("ClassMethodsAreCaseSensitive.bas");
101102
testSyntaxFail("NestedSub.bas");
102103
testSyntaxFail("DisplacedGlobal.bas");
103104
testSyntaxFail("DisplacedLocal.bas");
@@ -115,10 +116,10 @@ public void testPrograms() throws Exception {
115116
codeTest("TestForLoop1.bas", "123456789");
116117
codeTest("TestForLoop2.bas", "123456789");
117118
codeTest("TestForLoop3.bas",
118-
"1.01.52.02.53.03.54.04.55.05.56.06.57.07.58.08.59.09.5");
119+
"1.01.52.02.53.03.54.04.55.05.56.06.57.07.58.08.59.09.5");
119120
codeTest("TestForLoop4.bas", "987654321");
120121
codeTest("TestForLoop5.bas",
121-
"9.08.58.07.57.06.56.05.55.04.54.03.53.02.52.01.51.0");
122+
"9.08.58.07.57.06.56.05.55.04.54.03.53.02.52.01.51.0");
122123
codeTest("TestForLoop6.bas", "");
123124
codeTest("TestForLoop7.bas", "");
124125
codeTest("TestForLoop8.bas", "22");
@@ -127,7 +128,7 @@ public void testPrograms() throws Exception {
127128
codeTest("TestRuntimeFunction.bas", "1.01.5707963267948966");
128129
codeTest("TestNullFunction.bas", "undefundef");
129130
codeTest("TestMethodCall.bas",
130-
"" + Math.sin(1.0) + "\n" + Math.sin(1.0));
131+
"" + Math.sin(1.0) + "\n" + Math.sin(1.0));
131132
map = new HashMap<>();
132133
map.put("testClass", new TestClass());
133134
codeTest("TestObjectMethodCall.bas", map, "310");
@@ -166,7 +167,7 @@ public void testStringConcatenation() throws Exception {
166167
public void testStringFunctions() throws Exception {
167168
codeTest("TestStringFunctions.bas", "0189123");
168169
}
169-
170+
170171
@Test
171172
public void testJavaObjectFieldAccess() throws ScriptBasicException, ClassNotFoundException, AnalysisException {
172173
final var e = new TestingExecutor();
@@ -188,31 +189,31 @@ public void tooLargeArrayCannotBeCreated() {
188189
e.getCtx().configuration = configuration;
189190
configuration.set("arrayMaxIndex", "100");
190191
Assertions.assertThrows(BasicRuntimeException.class, () ->
191-
e.execute("AllocateTooLargeArray.bas"));
192+
e.execute("AllocateTooLargeArray.bas"));
192193
}
193194

194195
@Test()
195196
public void syntaxErrorWhenThereIsNoClosingParentheseAfterFunctionCall() {
196197
Assertions.assertThrows(CommandFactoryException.class, () ->
197-
codeTest("NoClosingParenAfterFunctionCall.bas", ""));
198+
codeTest("NoClosingParenAfterFunctionCall.bas", ""));
198199
}
199200

200201
@Test()
201202
public void syntaxErrorWhenNoClosingParenInExpression() {
202203
Assertions.assertThrows(CommandFactoryException.class, () ->
203-
codeTest("NoClosingParenInExpression.bas", ""));
204+
codeTest("NoClosingParenInExpression.bas", ""));
204205
}
205206

206207
@Test()
207208
public void syntaxErrorWhenNoClosingBracketAccessingArrayElement() {
208209
Assertions.assertThrows(CommandFactoryException.class, () ->
209-
codeTest("NoClosingBracketAccessingArrayElement.bas", ""));
210+
codeTest("NoClosingBracketAccessingArrayElement.bas", ""));
210211
}
211212

212213
@Test()
213214
public void syntaxErrorWhenSubroutineIsDefinedMoreThanOnce() {
214215
Assertions.assertThrows(BasicSyntaxException.class, () ->
215-
codeTest("SubroutineDoubleDefined.bas", ""));
216+
codeTest("SubroutineDoubleDefined.bas", ""));
216217
}
217218

218219
@Test
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
USE Math FROM java.lang
2+
g = Math.Sin(1.0)
3+
print "variable g: ", LeFt(""&g,3)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
method sin from java.lang.Math is (double) use as sinus
2+
USE Math FROM java.lang
23
g = Sinus(1.0)
4+
h = Math.sin(1.0)
35
print "variable g: ", LeFt(""&g,3)

0 commit comments

Comments
 (0)