Skip to content

Commit be6fde5

Browse files
committed
defaultAndSwitchAsVariable
1 parent 8cbe57d commit be6fde5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/main/antlr4/QLParser.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ varId
455455
| FUNCTION
456456
| CASE
457457
| DEFAULT
458+
| SWITCH
458459
;
459460

460461
// Switch (unified statement and expression)

src/test/java/com/alibaba/qlexpress4/Express4RunnerTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,4 +1831,12 @@ public void importClsAliasLowercaseAliasTest() {
18311831
// Should throw IllegalArgumentException when alias starts with lowercase
18321832
ImportManager.importClsAlias(ArrayList.class, "myList");
18331833
}
1834+
1835+
@Test
1836+
public void defaultAndSwitchAsVariable() {
1837+
Express4Runner express4Runner = new Express4Runner(InitOptions.DEFAULT_OPTIONS);
1838+
QLResult result = express4Runner
1839+
.execute("default = 1\nswitch = 2;\ndefault+switch", Collections.emptyMap(), QLOptions.DEFAULT_OPTIONS);
1840+
assertEquals(3, result.getResult());
1841+
}
18341842
}

0 commit comments

Comments
 (0)