Skip to content

Commit 9f09882

Browse files
ayushactiveatromani
authored andcommitted
Issue #7523: CLI '-s' option does not match by data from '-t'
1 parent 40f2a1d commit 9f09882

165 files changed

Lines changed: 61759 additions & 61721 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private static String printTree(DetailAST ast) {
185185
private static String getNodeInfo(DetailAST node) {
186186
return TokenUtil.getTokenName(node.getType())
187187
+ " -> " + escapeAllControlChars(node.getText())
188-
+ " [" + node.getLineNo() + ':' + node.getColumnNo() + ']';
188+
+ " [" + node.getLineNo() + ':' + (node.getColumnNo() + 1) + ']';
189189
}
190190

191191
/**

src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static String printTree(DetailNode ast, String rootPrefix, String prefix)
108108
messageBuilder.append(getIndentation(node))
109109
.append(JavadocUtil.getTokenName(node.getType())).append(" -> ")
110110
.append(JavadocUtil.escapeAllControlChars(node.getText())).append(" [")
111-
.append(node.getLineNumber()).append(':').append(node.getColumnNumber())
111+
.append(node.getLineNumber()).append(':').append(node.getColumnNumber() + 1)
112112
.append(']').append(LINE_SEPARATOR)
113113
.append(printTree(node.getFirstChild(), rootPrefix, prefix));
114114
node = node.getNextSibling();

src/test/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinterTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public void testPrintBranch() throws Exception {
7878
new File(getPath("InputAstTreeStringPrinterPrintBranch.java")),
7979
JavaParser.Options.WITH_COMMENTS);
8080
final String expected = addEndOfLine(
81-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
82-
"`--CLASS_DEF -> CLASS_DEF [3:0]",
83-
" |--MODIFIERS -> MODIFIERS [3:0]",
84-
" | `--LITERAL_PUBLIC -> public [3:0]");
81+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
82+
"`--CLASS_DEF -> CLASS_DEF [3:1]",
83+
" |--MODIFIERS -> MODIFIERS [3:1]",
84+
" | `--LITERAL_PUBLIC -> public [3:1]");
8585
final DetailAST nodeToPrint = ast.getFirstChild().getNextSibling()
8686
.getFirstChild().getFirstChild();
8787
final String result = AstTreeStringPrinter.printBranch(nodeToPrint);

src/test/java/com/puppycrawl/tools/checkstyle/MainTest.java

Lines changed: 126 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import java.util.logging.Handler;
4343
import java.util.logging.Level;
4444
import java.util.logging.Logger;
45+
import java.util.regex.Matcher;
4546
import java.util.regex.Pattern;
4647
import java.util.stream.Collectors;
4748

@@ -1007,34 +1008,34 @@ public void testPrintTreeOnMoreThanOneFile(@SysErr Capturable systemErr,
10071008
@Test
10081009
public void testPrintTreeOption(@SysErr Capturable systemErr, @SysOut Capturable systemOut) {
10091010
final String expected = addEndOfLine(
1010-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
1011-
"|--PACKAGE_DEF -> package [1:0]",
1012-
"| |--ANNOTATIONS -> ANNOTATIONS [1:39]",
1013-
"| |--DOT -> . [1:39]",
1014-
"| | |--DOT -> . [1:28]",
1015-
"| | | |--DOT -> . [1:22]",
1016-
"| | | | |--DOT -> . [1:11]",
1017-
"| | | | | |--IDENT -> com [1:8]",
1018-
"| | | | | `--IDENT -> puppycrawl [1:12]",
1019-
"| | | | `--IDENT -> tools [1:23]",
1020-
"| | | `--IDENT -> checkstyle [1:29]",
1021-
"| | `--IDENT -> main [1:40]",
1022-
"| `--SEMI -> ; [1:44]",
1023-
"|--CLASS_DEF -> CLASS_DEF [3:0]",
1024-
"| |--MODIFIERS -> MODIFIERS [3:0]",
1025-
"| | `--LITERAL_PUBLIC -> public [3:0]",
1026-
"| |--LITERAL_CLASS -> class [3:7]",
1027-
"| |--IDENT -> InputMain [3:13]",
1028-
"| `--OBJBLOCK -> OBJBLOCK [3:23]",
1029-
"| |--LCURLY -> { [3:23]",
1030-
"| `--RCURLY -> } [4:0]",
1031-
"`--CLASS_DEF -> CLASS_DEF [5:0]",
1032-
" |--MODIFIERS -> MODIFIERS [5:0]",
1033-
" |--LITERAL_CLASS -> class [5:0]",
1034-
" |--IDENT -> InputMainInner [5:6]",
1035-
" `--OBJBLOCK -> OBJBLOCK [5:21]",
1036-
" |--LCURLY -> { [5:21]",
1037-
" `--RCURLY -> } [6:0]");
1011+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
1012+
"|--PACKAGE_DEF -> package [1:1]",
1013+
"| |--ANNOTATIONS -> ANNOTATIONS [1:40]",
1014+
"| |--DOT -> . [1:40]",
1015+
"| | |--DOT -> . [1:29]",
1016+
"| | | |--DOT -> . [1:23]",
1017+
"| | | | |--DOT -> . [1:12]",
1018+
"| | | | | |--IDENT -> com [1:9]",
1019+
"| | | | | `--IDENT -> puppycrawl [1:13]",
1020+
"| | | | `--IDENT -> tools [1:24]",
1021+
"| | | `--IDENT -> checkstyle [1:30]",
1022+
"| | `--IDENT -> main [1:41]",
1023+
"| `--SEMI -> ; [1:45]",
1024+
"|--CLASS_DEF -> CLASS_DEF [3:1]",
1025+
"| |--MODIFIERS -> MODIFIERS [3:1]",
1026+
"| | `--LITERAL_PUBLIC -> public [3:1]",
1027+
"| |--LITERAL_CLASS -> class [3:8]",
1028+
"| |--IDENT -> InputMain [3:14]",
1029+
"| `--OBJBLOCK -> OBJBLOCK [3:24]",
1030+
"| |--LCURLY -> { [3:24]",
1031+
"| `--RCURLY -> } [4:1]",
1032+
"`--CLASS_DEF -> CLASS_DEF [5:1]",
1033+
" |--MODIFIERS -> MODIFIERS [5:1]",
1034+
" |--LITERAL_CLASS -> class [5:1]",
1035+
" |--IDENT -> InputMainInner [5:7]",
1036+
" `--OBJBLOCK -> OBJBLOCK [5:22]",
1037+
" |--LCURLY -> { [5:22]",
1038+
" `--RCURLY -> } [6:1]");
10381039

10391040
assertMainReturnCode(0, "-t", getPath("InputMain.java"));
10401041
assertWithMessage("Unexpected output log")
@@ -1048,13 +1049,13 @@ public void testPrintTreeOption(@SysErr Capturable systemErr, @SysOut Capturable
10481049
@Test
10491050
public void testPrintXpathOption(@SysErr Capturable systemErr, @SysOut Capturable systemOut) {
10501051
final String expected = addEndOfLine(
1051-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
1052-
"|--CLASS_DEF -> CLASS_DEF [3:0]",
1053-
"| `--OBJBLOCK -> OBJBLOCK [3:28]",
1054-
"| |--METHOD_DEF -> METHOD_DEF [4:4]",
1055-
"| | `--SLIST -> { [4:20]",
1056-
"| | |--VARIABLE_DEF -> VARIABLE_DEF [5:8]",
1057-
"| | | |--IDENT -> a [5:12]");
1052+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
1053+
"|--CLASS_DEF -> CLASS_DEF [3:1]",
1054+
"| `--OBJBLOCK -> OBJBLOCK [3:29]",
1055+
"| |--METHOD_DEF -> METHOD_DEF [4:5]",
1056+
"| | `--SLIST -> { [4:21]",
1057+
"| | |--VARIABLE_DEF -> VARIABLE_DEF [5:9]",
1058+
"| | | |--IDENT -> a [5:13]");
10581059
assertMainReturnCode(0, "-b",
10591060
"/COMPILATION_UNIT/CLASS_DEF//METHOD_DEF[./IDENT[@text='methodOne']]"
10601061
+ "//VARIABLE_DEF/IDENT",
@@ -1067,15 +1068,53 @@ public void testPrintXpathOption(@SysErr Capturable systemErr, @SysOut Capturabl
10671068
.isEqualTo("");
10681069
}
10691070

1071+
@Test
1072+
public void testCliTreeAndSuppressionConsistency(@SysOut Capturable systemOut) {
1073+
final String filePath = getPath("InputMain.java");
1074+
1075+
assertMainReturnCode(0, "-t", filePath);
1076+
1077+
final String treeOutput = systemOut.getCapturedData();
1078+
1079+
final Pattern pattern = Pattern.compile("(\\w+) -> .*?\\[(\\d+:\\d+)]");
1080+
final Matcher matcher = pattern.matcher(treeOutput);
1081+
1082+
boolean foundAtLeastOne = false;
1083+
while (matcher.find()) {
1084+
foundAtLeastOne = true;
1085+
final String tokenName = matcher.group(1);
1086+
1087+
if (!"COMPILATION_UNIT".equals(tokenName)) {
1088+
final String coordinates = matcher.group(2);
1089+
1090+
final int previousLength = systemOut.getCapturedData().length();
1091+
1092+
assertMainReturnCode(0, "-s", coordinates, filePath);
1093+
1094+
final String allOutput = systemOut.getCapturedData();
1095+
final String newOutput = allOutput.substring(previousLength);
1096+
1097+
assertWithMessage("CLI -s should return XPath ending in /%s for coordinates %s",
1098+
tokenName, coordinates)
1099+
.that(newOutput)
1100+
.contains("/" + tokenName);
1101+
}
1102+
}
1103+
1104+
assertWithMessage("Should have found at least one token in -t output")
1105+
.that(foundAtLeastOne)
1106+
.isTrue();
1107+
}
1108+
10701109
@Test
10711110
public void testPrintXpathCommentNode(@SysErr Capturable systemErr,
10721111
@SysOut Capturable systemOut) {
10731112
final String expected = addEndOfLine(
1074-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
1075-
"`--CLASS_DEF -> CLASS_DEF [17:0]",
1076-
" `--OBJBLOCK -> OBJBLOCK [17:19]",
1077-
" |--CTOR_DEF -> CTOR_DEF [19:4]",
1078-
" | |--BLOCK_COMMENT_BEGIN -> /* [18:4]");
1113+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
1114+
"`--CLASS_DEF -> CLASS_DEF [17:1]",
1115+
" `--OBJBLOCK -> OBJBLOCK [17:20]",
1116+
" |--CTOR_DEF -> CTOR_DEF [19:5]",
1117+
" | |--BLOCK_COMMENT_BEGIN -> /* [18:5]");
10791118
assertMainReturnCode(0, "-b", "/COMPILATION_UNIT/CLASS_DEF//BLOCK_COMMENT_BEGIN",
10801119
getPath("InputMainXPath.java"));
10811120
assertWithMessage("Unexpected output log")
@@ -1089,7 +1128,7 @@ public void testPrintXpathCommentNode(@SysErr Capturable systemErr,
10891128
@Test
10901129
public void testPrintXpathNodeParentNull(@SysErr Capturable systemErr,
10911130
@SysOut Capturable systemOut) {
1092-
final String expected = addEndOfLine("COMPILATION_UNIT -> COMPILATION_UNIT [1:0]");
1131+
final String expected = addEndOfLine("COMPILATION_UNIT -> COMPILATION_UNIT [1:1]");
10931132
assertMainReturnCode(0, "-b", "/COMPILATION_UNIT", getPath("InputMainXPath.java"));
10941133
assertWithMessage("Unexpected output log")
10951134
.that(systemOut.getCapturedData())
@@ -1103,13 +1142,13 @@ public void testPrintXpathNodeParentNull(@SysErr Capturable systemErr,
11031142
public void testPrintXpathFullOption(
11041143
@SysErr Capturable systemErr, @SysOut Capturable systemOut) {
11051144
final String expected = addEndOfLine(
1106-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
1107-
"|--CLASS_DEF -> CLASS_DEF [3:0]",
1108-
"| `--OBJBLOCK -> OBJBLOCK [3:28]",
1109-
"| |--METHOD_DEF -> METHOD_DEF [8:4]",
1110-
"| | `--SLIST -> { [8:26]",
1111-
"| | |--VARIABLE_DEF -> VARIABLE_DEF [9:8]",
1112-
"| | | |--IDENT -> a [9:12]");
1145+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
1146+
"|--CLASS_DEF -> CLASS_DEF [3:1]",
1147+
"| `--OBJBLOCK -> OBJBLOCK [3:29]",
1148+
"| |--METHOD_DEF -> METHOD_DEF [8:5]",
1149+
"| | `--SLIST -> { [8:27]",
1150+
"| | |--VARIABLE_DEF -> VARIABLE_DEF [9:9]",
1151+
"| | | |--IDENT -> a [9:13]");
11131152
final String xpath = "/COMPILATION_UNIT/CLASS_DEF//METHOD_DEF[./IDENT[@text='method']]"
11141153
+ "//VARIABLE_DEF/IDENT";
11151154
assertMainReturnCode(0, "--branch-matching-xpath", xpath, getPath("InputMainXPath.java"));
@@ -1125,15 +1164,15 @@ public void testPrintXpathFullOption(
11251164
public void testPrintXpathTwoResults(
11261165
@SysErr Capturable systemErr, @SysOut Capturable systemOut) {
11271166
final String expected = addEndOfLine(
1128-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
1129-
"|--CLASS_DEF -> CLASS_DEF [12:0]",
1130-
"| `--OBJBLOCK -> OBJBLOCK [12:10]",
1131-
"| |--METHOD_DEF -> METHOD_DEF [13:4]",
1167+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
1168+
"|--CLASS_DEF -> CLASS_DEF [12:1]",
1169+
"| `--OBJBLOCK -> OBJBLOCK [12:11]",
1170+
"| |--METHOD_DEF -> METHOD_DEF [13:5]",
11321171
"---------",
1133-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
1134-
"|--CLASS_DEF -> CLASS_DEF [12:0]",
1135-
"| `--OBJBLOCK -> OBJBLOCK [12:10]",
1136-
"| |--METHOD_DEF -> METHOD_DEF [14:4]");
1172+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
1173+
"|--CLASS_DEF -> CLASS_DEF [12:1]",
1174+
"| `--OBJBLOCK -> OBJBLOCK [12:11]",
1175+
"| |--METHOD_DEF -> METHOD_DEF [14:5]");
11371176
assertMainReturnCode(0, "--branch-matching-xpath",
11381177
"/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='Two']]//METHOD_DEF",
11391178
getPath("InputMainXPath.java"));
@@ -1163,37 +1202,37 @@ public void testPrintXpathInvalidXpath(@SysErr Capturable systemErr) throws Exce
11631202
public void testPrintTreeCommentsOption(@SysErr Capturable systemErr,
11641203
@SysOut Capturable systemOut) {
11651204
final String expected = addEndOfLine(
1166-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
1167-
"|--PACKAGE_DEF -> package [1:0]",
1168-
"| |--ANNOTATIONS -> ANNOTATIONS [1:39]",
1169-
"| |--DOT -> . [1:39]",
1170-
"| | |--DOT -> . [1:28]",
1171-
"| | | |--DOT -> . [1:22]",
1172-
"| | | | |--DOT -> . [1:11]",
1173-
"| | | | | |--IDENT -> com [1:8]",
1174-
"| | | | | `--IDENT -> puppycrawl [1:12]",
1175-
"| | | | `--IDENT -> tools [1:23]",
1176-
"| | | `--IDENT -> checkstyle [1:29]",
1177-
"| | `--IDENT -> main [1:40]",
1178-
"| `--SEMI -> ; [1:44]",
1179-
"|--CLASS_DEF -> CLASS_DEF [3:0]",
1180-
"| |--MODIFIERS -> MODIFIERS [3:0]",
1181-
"| | |--BLOCK_COMMENT_BEGIN -> /* [2:0]",
1182-
"| | | |--COMMENT_CONTENT -> comment [2:2]",
1183-
"| | | `--BLOCK_COMMENT_END -> */ [2:8]",
1184-
"| | `--LITERAL_PUBLIC -> public [3:0]",
1185-
"| |--LITERAL_CLASS -> class [3:7]",
1186-
"| |--IDENT -> InputMain [3:13]",
1187-
"| `--OBJBLOCK -> OBJBLOCK [3:23]",
1188-
"| |--LCURLY -> { [3:23]",
1189-
"| `--RCURLY -> } [4:0]",
1190-
"`--CLASS_DEF -> CLASS_DEF [5:0]",
1191-
" |--MODIFIERS -> MODIFIERS [5:0]",
1192-
" |--LITERAL_CLASS -> class [5:0]",
1193-
" |--IDENT -> InputMainInner [5:6]",
1194-
" `--OBJBLOCK -> OBJBLOCK [5:21]",
1195-
" |--LCURLY -> { [5:21]",
1196-
" `--RCURLY -> } [6:0]");
1205+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
1206+
"|--PACKAGE_DEF -> package [1:1]",
1207+
"| |--ANNOTATIONS -> ANNOTATIONS [1:40]",
1208+
"| |--DOT -> . [1:40]",
1209+
"| | |--DOT -> . [1:29]",
1210+
"| | | |--DOT -> . [1:23]",
1211+
"| | | | |--DOT -> . [1:12]",
1212+
"| | | | | |--IDENT -> com [1:9]",
1213+
"| | | | | `--IDENT -> puppycrawl [1:13]",
1214+
"| | | | `--IDENT -> tools [1:24]",
1215+
"| | | `--IDENT -> checkstyle [1:30]",
1216+
"| | `--IDENT -> main [1:41]",
1217+
"| `--SEMI -> ; [1:45]",
1218+
"|--CLASS_DEF -> CLASS_DEF [3:1]",
1219+
"| |--MODIFIERS -> MODIFIERS [3:1]",
1220+
"| | |--BLOCK_COMMENT_BEGIN -> /* [2:1]",
1221+
"| | | |--COMMENT_CONTENT -> comment [2:3]",
1222+
"| | | `--BLOCK_COMMENT_END -> */ [2:9]",
1223+
"| | `--LITERAL_PUBLIC -> public [3:1]",
1224+
"| |--LITERAL_CLASS -> class [3:8]",
1225+
"| |--IDENT -> InputMain [3:14]",
1226+
"| `--OBJBLOCK -> OBJBLOCK [3:24]",
1227+
"| |--LCURLY -> { [3:24]",
1228+
"| `--RCURLY -> } [4:1]",
1229+
"`--CLASS_DEF -> CLASS_DEF [5:1]",
1230+
" |--MODIFIERS -> MODIFIERS [5:1]",
1231+
" |--LITERAL_CLASS -> class [5:1]",
1232+
" |--IDENT -> InputMainInner [5:7]",
1233+
" `--OBJBLOCK -> OBJBLOCK [5:22]",
1234+
" |--LCURLY -> { [5:22]",
1235+
" `--RCURLY -> } [6:1]");
11971236

11981237
assertMainReturnCode(0, "-T", getPath("InputMain.java"));
11991238
assertWithMessage("Unexpected output log")
@@ -2050,5 +2089,4 @@ public void close() {
20502089
}
20512090

20522091
}
2053-
20542092
}

src/test/java/com/puppycrawl/tools/checkstyle/utils/XpathUtilTest.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ public void testPrintXpathNotComment() throws Exception {
105105
final File file = new File(tempFolder, uniqueFileName);
106106
Files.writeString(file.toPath(), fileContent, StandardCharsets.UTF_8);
107107
final String expected = addEndOfLine(
108-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
109-
"`--CLASS_DEF -> CLASS_DEF [1:0]",
110-
" `--OBJBLOCK -> OBJBLOCK [1:11]",
111-
" |--METHOD_DEF -> METHOD_DEF [1:13]",
112-
" | `--SLIST -> { [1:34]",
113-
" | |--VARIABLE_DEF -> VARIABLE_DEF [1:35]",
114-
" | | |--IDENT -> a [1:39]");
108+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
109+
"`--CLASS_DEF -> CLASS_DEF [1:1]",
110+
" `--OBJBLOCK -> OBJBLOCK [1:12]",
111+
" |--METHOD_DEF -> METHOD_DEF [1:14]",
112+
" | `--SLIST -> { [1:35]",
113+
" | |--VARIABLE_DEF -> VARIABLE_DEF [1:36]",
114+
" | | |--IDENT -> a [1:40]");
115115
final String result = XpathUtil.printXpathBranch(
116116
"//CLASS_DEF//METHOD_DEF//VARIABLE_DEF//IDENT", file);
117117
assertWithMessage("Branch string is different")
@@ -126,10 +126,10 @@ public void testPrintXpathComment() throws Exception {
126126
final File file = new File(tempFolder, uniqueFileName);
127127
Files.writeString(file.toPath(), fileContent, StandardCharsets.UTF_8);
128128
final String expected = addEndOfLine(
129-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
130-
"`--CLASS_DEF -> CLASS_DEF [1:0]",
131-
" `--OBJBLOCK -> OBJBLOCK [1:11]",
132-
" |--BLOCK_COMMENT_BEGIN -> /* [1:13]");
129+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
130+
"`--CLASS_DEF -> CLASS_DEF [1:1]",
131+
" `--OBJBLOCK -> OBJBLOCK [1:12]",
132+
" |--BLOCK_COMMENT_BEGIN -> /* [1:14]");
133133
final String result = XpathUtil.printXpathBranch(
134134
"//CLASS_DEF//BLOCK_COMMENT_BEGIN", file);
135135
assertWithMessage("Branch string is different")
@@ -144,21 +144,21 @@ public void testPrintXpathTwo() throws Exception {
144144
final File file = new File(tempFolder, uniqueFileName);
145145
Files.writeString(file.toPath(), fileContent, StandardCharsets.UTF_8);
146146
final String expected = addEndOfLine(
147-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
148-
"`--CLASS_DEF -> CLASS_DEF [1:0]",
149-
" `--OBJBLOCK -> OBJBLOCK [1:11]",
150-
" |--METHOD_DEF -> METHOD_DEF [1:13]",
151-
" | `--SLIST -> { [1:34]",
152-
" | |--VARIABLE_DEF -> VARIABLE_DEF [1:35]",
153-
" | | |--IDENT -> a [1:39]",
147+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
148+
"`--CLASS_DEF -> CLASS_DEF [1:1]",
149+
" `--OBJBLOCK -> OBJBLOCK [1:12]",
150+
" |--METHOD_DEF -> METHOD_DEF [1:14]",
151+
" | `--SLIST -> { [1:35]",
152+
" | |--VARIABLE_DEF -> VARIABLE_DEF [1:36]",
153+
" | | |--IDENT -> a [1:40]",
154154
"---------",
155-
"COMPILATION_UNIT -> COMPILATION_UNIT [1:0]",
156-
"`--CLASS_DEF -> CLASS_DEF [1:0]",
157-
" `--OBJBLOCK -> OBJBLOCK [1:11]",
158-
" |--METHOD_DEF -> METHOD_DEF [1:13]",
159-
" | `--SLIST -> { [1:34]",
160-
" | |--VARIABLE_DEF -> VARIABLE_DEF [1:46]",
161-
" | | |--IDENT -> b [1:50]");
155+
"COMPILATION_UNIT -> COMPILATION_UNIT [1:1]",
156+
"`--CLASS_DEF -> CLASS_DEF [1:1]",
157+
" `--OBJBLOCK -> OBJBLOCK [1:12]",
158+
" |--METHOD_DEF -> METHOD_DEF [1:14]",
159+
" | `--SLIST -> { [1:35]",
160+
" | |--VARIABLE_DEF -> VARIABLE_DEF [1:47]",
161+
" | | |--IDENT -> b [1:51]");
162162
final String result = XpathUtil.printXpathBranch(
163163
"//CLASS_DEF//METHOD_DEF//VARIABLE_DEF//IDENT", file);
164164
assertWithMessage("Branch string is different")

0 commit comments

Comments
 (0)