Skip to content

Commit 9bbfd16

Browse files
committed
Add test for function name column formatting and corresponding SQL files
1 parent 94197a1 commit 9bbfd16

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

src/test/kotlin/org/domaframework/doma/intellij/formatter/SqlFormatterTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ class SqlFormatterTest : BasePlatformTestCase() {
262262
formatSqlFile("FunctionKeywordInConditionDirective.sql", "FunctionKeywordInConditionDirective$formatDataPrefix.sql")
263263
}
264264

265+
fun testFunctionNameColumnFormatter() {
266+
formatSqlFile("FunctionNameColumn.sql", "FunctionNameColumn$formatDataPrefix.sql")
267+
}
268+
265269
private fun formatSqlFile(
266270
beforeFile: String,
267271
afterFile: String,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
SELECT id
2+
, [age]
3+
, /*%if maxAge*/
4+
number + age(/* timestamp1 */'2099-12-31'
5+
, /* timestamp2 */'2099-12-31')
6+
/*%else*/
7+
name
8+
,
9+
/*%end*/" age"
10+
FROM employee
11+
WHERE (/*%for age : ages */
12+
" age"
13+
= /* age */30
14+
/*%if age_has_next *//*# "and" *//*%else */
15+
/*%end */
16+
/*%end */)
17+
AND (/*%for age : ages */
18+
abs = /* abs */30
19+
AND age >= 20
20+
/*%if age_has_next */
21+
/*# "or" */
22+
/*%else */
23+
/*%end */
24+
/*%end */)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
SELECT id
2+
, [age]
3+
, /*%if maxAge*/
4+
number + age(/* timestamp1 */'2099-12-31'
5+
, /* timestamp2 */'2099-12-31')
6+
/*%else*/
7+
name
8+
,
9+
/*%end*/
10+
"age"
11+
FROM employee
12+
WHERE (/*%for age : ages */
13+
"age" = /* age */30
14+
/*%if age_has_next */
15+
/*# "and" */
16+
/*%else */
17+
/*%end */
18+
/*%end */)
19+
AND (/*%for age : ages */
20+
abs = /* abs */30
21+
AND age >= 20
22+
/*%if age_has_next */
23+
/*# "or" */
24+
/*%else */
25+
/*%end */
26+
/*%end */)

0 commit comments

Comments
 (0)