Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 3fe7ff5

Browse files
add test cases for A23: enforce line break after single line comment to reproduce #197
1 parent 35f50bb commit 3fe7ff5

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.trivadis.plsql.formatter.settings.tests.rules;
2+
3+
import com.trivadis.plsql.formatter.settings.ConfiguredTestFormatter;
4+
import org.junit.jupiter.api.Nested;
5+
import org.junit.jupiter.api.Test;
6+
7+
public class A23_enforce_line_break_after_single_line_comment extends ConfiguredTestFormatter {
8+
9+
@Nested
10+
class case_expression {
11+
12+
@Test
13+
public void comment_before_then() {
14+
var sql = """
15+
select empno,
16+
ename,
17+
case
18+
when 'JOB' = 'SALESMAN' -- make gender-neutral
19+
then
20+
'SALESPERSON'
21+
else
22+
job
23+
end as job,
24+
sal
25+
from emp;
26+
""";
27+
formatAndAssert(sql);
28+
}
29+
30+
@Test
31+
public void comment_after_every_token() {
32+
var sql = """
33+
select empno,
34+
ename,
35+
case
36+
when -- comment 1
37+
'JOB' -- comment 2
38+
= -- comment 3
39+
'SALESMAN' -- comment 4
40+
then -- comment 5
41+
'SALESPERSON' -- comment 6
42+
else -- comment 7
43+
job -- comment 8
44+
end -- comment 9
45+
as -- comment 10
46+
job,
47+
sal
48+
from emp;
49+
""";
50+
formatAndAssert(sql);
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)