Skip to content

Commit 6cda290

Browse files
authored
Support any decorator ending in Test in runnables (#200)
Address #198
1 parent a26f84b commit 6cda290

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

languages/java/runnables.scm

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
(#set! tag java-main)
4343
)
4444

45-
; Run test function
45+
; Run test function (marker annotation, e.g. @Test)
4646
(
4747
(package_declaration
4848
(scoped_identifier) @java_package_name
@@ -52,12 +52,15 @@
5252
body: (class_body
5353
(method_declaration
5454
(modifiers
55-
(marker_annotation
55+
[(marker_annotation
5656
name: (identifier) @annotation_name
5757
)
58+
(annotation
59+
name: (identifier) @annotation_name
60+
)]
5861
)
5962
name: (identifier) @run @java_method_name
60-
(#eq? @annotation_name "Test")
63+
(#match? @annotation_name "Test$")
6164
)
6265
)
6366
) @_
@@ -82,12 +85,15 @@
8285
body: (class_body
8386
(method_declaration
8487
(modifiers
85-
(marker_annotation
88+
[(marker_annotation
8689
name: (identifier) @annotation_name
8790
)
91+
(annotation
92+
name: (identifier) @annotation_name
93+
)]
8894
)
8995
name: (identifier) @run @java_method_name
90-
(#eq? @annotation_name "Test")
96+
(#match? @annotation_name "Test$")
9197
)
9298
)
9399
(#eq? @nested_annotation "Nested")
@@ -107,11 +113,14 @@
107113
body: (class_body
108114
(method_declaration
109115
(modifiers
110-
(marker_annotation
116+
[(marker_annotation
111117
name: (identifier) @annotation_name
112118
)
119+
(annotation
120+
name: (identifier) @annotation_name
121+
)]
113122
)
114-
(#eq? @annotation_name "Test")
123+
(#match? @annotation_name "Test$")
115124
)
116125
)
117126
) @_
@@ -136,11 +145,14 @@
136145
body: (class_body
137146
(method_declaration
138147
(modifiers
139-
(marker_annotation
148+
[(marker_annotation
140149
name: (identifier) @annotation_name
141150
)
151+
(annotation
152+
name: (identifier) @annotation_name
153+
)]
142154
)
143-
(#eq? @annotation_name "Test")
155+
(#match? @annotation_name "Test$")
144156
)
145157
)
146158
(#eq? @nested_annotation "Nested")

0 commit comments

Comments
 (0)