Skip to content

Commit 2b6d7bb

Browse files
committed
Add support for InlineExpectationsTest to Kotlin
1 parent 3b07fe7 commit 2b6d7bb

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

java/ql/test/TestUtilities/InlineExpectationsTestPrivate.qll

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@ import java
44
* A class representing line comments in Java, which is simply Javadoc restricted
55
* to EOL comments, with an extra accessor used by the InlineExpectations core code
66
*/
7-
class ExpectationComment extends Javadoc {
8-
ExpectationComment() { isEolComment(this) }
9-
7+
abstract class ExpectationComment extends Top {
108
/** Gets the contents of the given comment, _without_ the preceding comment marker (`//`). */
11-
string getContents() { result = this.getChild(0).toString() }
9+
abstract string getContents();
10+
}
11+
12+
private class JavadocExpectationComment extends Javadoc, ExpectationComment {
13+
JavadocExpectationComment() { isEolComment(this) }
14+
15+
override string getContents() { result = this.getChild(0).toString() }
16+
}
17+
18+
private class KtExpectationComment extends KtComment, ExpectationComment {
19+
override string getContents() {
20+
result = this.getText().regexpCapture("(?://|/\\*)(.*)(?:\\*/)?", 1)
21+
}
1222
}

0 commit comments

Comments
 (0)