forked from SAP/abap-cleaner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpaceAroundCommentSignTest.java
100 lines (75 loc) · 2.85 KB
/
SpaceAroundCommentSignTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.sap.adt.abapcleaner.rules.spaces;
import org.junit.jupiter.api.Test;
import com.sap.adt.abapcleaner.rulebase.RuleID;
import com.sap.adt.abapcleaner.rulebase.RuleTestBase;
public class SpaceAroundCommentSignTest extends RuleTestBase {
private SpaceAroundCommentSignRule rule;
SpaceAroundCommentSignTest() {
super(RuleID.SPACE_AROUND_COMMENT_SIGN);
rule = (SpaceAroundCommentSignRule)getRule();
rule.configSpaceBeforeCommentSign.setValue(true);
rule.configSpaceAfterCommentSign.setValue(true);
}
@Test
void testSpaceAfterLineEndComments() {
buildSrc(" CLEAR ev_result. \"comment at line end");
buildExp(" CLEAR ev_result. \" comment at line end");
putAnyMethodAroundSrcAndExp();
testRule();
}
@Test
void testSpaceAfterFullLineComments() {
buildSrc(" \"Comment signs");
buildSrc(" \"are NOT the same as \"quotation marks\",");
buildSrc(" \"so it looks much better");
buildSrc(" \"to put a space between the \" and the text.");
buildExp(" \" Comment signs");
buildExp(" \" are NOT the same as \"quotation marks\",");
buildExp(" \" so it looks much better");
buildExp(" \" to put a space between the \" and the text.");
putAnyMethodAroundSrcAndExp();
testRule();
}
@Test
void testSpaceBeforeLineEndComments() {
buildSrc(" lv_value = 0.\" comment");
buildSrc("");
buildSrc(" ls_pair = VALUE #(\" initial comment");
buildSrc(" a = '3.1415'\" pi");
buildSrc(" b = '1.4142'\" sqrt(2)");
buildSrc(" ).\" final comment");
buildExp(" lv_value = 0. \" comment");
buildExp("");
buildExp(" ls_pair = VALUE #( \" initial comment");
buildExp(" a = '3.1415' \" pi");
buildExp(" b = '1.4142' \" sqrt(2)");
buildExp(" ). \" final comment");
putAnyMethodAroundSrcAndExp();
testRule();
}
@Test
void testSpaceBeforeAndAfterLineEndComments() {
buildSrc(" lv_value = 0.\"comment");
buildSrc("");
buildSrc(" ls_pair = VALUE #(\"initial comment");
buildSrc(" a = '3.1415'\" pi");
buildSrc(" b = '1.4142'\" sqrt(2)");
buildSrc(" ).\"final comment");
buildExp(" lv_value = 0. \" comment");
buildExp("");
buildExp(" ls_pair = VALUE #( \" initial comment");
buildExp(" a = '3.1415' \" pi");
buildExp(" b = '1.4142' \" sqrt(2)");
buildExp(" ). \" final comment");
putAnyMethodAroundSrcAndExp();
testRule();
}
@Test
void testSpaceBeforeFullLineComments() {
buildSrc(" \" comment lines are not changed by this(!) rule,");
buildSrc("\" even if they are not indented at all");
copyExpFromSrc(); // no change expected
putAnyMethodAroundSrcAndExp();
testRule();
}
}