File tree Expand file tree Collapse file tree 8 files changed +109
-0
lines changed
runtime-testsuite/test/org/antlr/v4/test/runtime Expand file tree Collapse file tree 8 files changed +109
-0
lines changed Original file line number Diff line number Diff line change 44
44
import org .antlr .v4 .tool .GrammarSemanticsMessage ;
45
45
import org .antlr .v4 .tool .LexerGrammar ;
46
46
import org .antlr .v4 .tool .Rule ;
47
+ import org .junit .rules .TestRule ;
48
+ import org .junit .rules .TestWatcher ;
49
+ import org .junit .runner .Description ;
47
50
import org .stringtemplate .v4 .ST ;
48
51
import org .stringtemplate .v4 .STGroup ;
49
52
import org .stringtemplate .v4 .STGroupString ;
@@ -89,6 +92,17 @@ public class BaseCppTest implements RuntimeTestSupport {
89
92
/** Errors found while running antlr */
90
93
protected StringBuilder antlrToolErrors ;
91
94
95
+ @ org .junit .Rule
96
+ public final TestRule testWatcher = new TestWatcher () {
97
+
98
+ @ Override
99
+ protected void succeeded (Description description ) {
100
+ // remove tmpdir if no error.
101
+ eraseTempDir ();
102
+ }
103
+
104
+ };
105
+
92
106
private String getPropertyPrefix () {
93
107
return "antlr-" + getLanguage ().toLowerCase ();
94
108
}
Original file line number Diff line number Diff line change @@ -121,6 +121,17 @@ public class BaseCSharpTest implements RuntimeTestSupport {
121
121
*/
122
122
protected StringBuilder antlrToolErrors ;
123
123
124
+ @ org .junit .Rule
125
+ public final TestRule testWatcher = new TestWatcher () {
126
+
127
+ @ Override
128
+ protected void succeeded (Description description ) {
129
+ // remove tmpdir if no error.
130
+ eraseTempDir ();
131
+ }
132
+
133
+ };
134
+
124
135
@ Override
125
136
public void testSetUp () throws Exception {
126
137
if (CREATE_PER_TEST_DIRECTORIES ) {
Original file line number Diff line number Diff line change 26
26
import org .antlr .v4 .test .runtime .descriptors .LexerExecDescriptors ;
27
27
import org .antlr .v4 .test .runtime .descriptors .PerformanceDescriptors ;
28
28
import org .antlr .v4 .tool .*;
29
+ import org .junit .rules .TestRule ;
30
+ import org .junit .rules .TestWatcher ;
31
+ import org .junit .runner .Description ;
29
32
import org .stringtemplate .v4 .ST ;
30
33
import org .stringtemplate .v4 .STGroup ;
31
34
import org .stringtemplate .v4 .STGroupString ;
@@ -126,6 +129,17 @@ public class BaseDartTest implements RuntimeTestSupport {
126
129
127
130
private static String cacheDartPackages ;
128
131
132
+ @ org .junit .Rule
133
+ public final TestRule testWatcher = new TestWatcher () {
134
+
135
+ @ Override
136
+ protected void succeeded (Description description ) {
137
+ // remove tmpdir if no error.
138
+ eraseTempDir ();
139
+ }
140
+
141
+ };
142
+
129
143
private String getPropertyPrefix () {
130
144
return "antlr-dart" ;
131
145
}
Original file line number Diff line number Diff line change 41
41
import org .antlr .v4 .tool .GrammarSemanticsMessage ;
42
42
import org .antlr .v4 .tool .LexerGrammar ;
43
43
import org .antlr .v4 .tool .Rule ;
44
+ import org .junit .rules .TestRule ;
45
+ import org .junit .rules .TestWatcher ;
46
+ import org .junit .runner .Description ;
44
47
import org .stringtemplate .v4 .ST ;
45
48
import org .stringtemplate .v4 .STGroup ;
46
49
import org .stringtemplate .v4 .STGroupString ;
@@ -86,6 +89,17 @@ public class BaseGoTest implements RuntimeTestSupport {
86
89
/** Errors found while running antlr */
87
90
protected StringBuilder antlrToolErrors ;
88
91
92
+ @ org .junit .Rule
93
+ public final TestRule testWatcher = new TestWatcher () {
94
+
95
+ @ Override
96
+ protected void succeeded (Description description ) {
97
+ // remove tmpdir if no error.
98
+ eraseTempDir ();
99
+ }
100
+
101
+ };
102
+
89
103
/**
90
104
* Copies all files from go runtime to a temporary folder that is inside a valid GOPATH project structure.
91
105
*/
Original file line number Diff line number Diff line change 42
42
import org .antlr .v4 .tool .GrammarSemanticsMessage ;
43
43
import org .antlr .v4 .tool .LexerGrammar ;
44
44
import org .antlr .v4 .tool .Rule ;
45
+ import org .junit .rules .TestRule ;
46
+ import org .junit .rules .TestWatcher ;
47
+ import org .junit .runner .Description ;
45
48
import org .stringtemplate .v4 .ST ;
46
49
import org .stringtemplate .v4 .STGroup ;
47
50
import org .stringtemplate .v4 .STGroupString ;
@@ -170,6 +173,17 @@ public class BaseJavaTest implements RuntimeTestSupport {
170
173
*/
171
174
protected StringBuilder antlrToolErrors ;
172
175
176
+ @ org .junit .Rule
177
+ public final TestRule testWatcher = new TestWatcher () {
178
+
179
+ @ Override
180
+ protected void succeeded (Description description ) {
181
+ // remove tmpdir if no error.
182
+ eraseTempDir ();
183
+ }
184
+
185
+ };
186
+
173
187
@ Override
174
188
public void testSetUp () throws Exception {
175
189
// STGroup.verbose = true;
Original file line number Diff line number Diff line change 15
15
import org .antlr .v4 .test .runtime .*;
16
16
import org .antlr .v4 .tool .Grammar ;
17
17
import org .antlr .v4 .tool .LexerGrammar ;
18
+ import org .junit .rules .TestRule ;
19
+ import org .junit .rules .TestWatcher ;
20
+ import org .junit .runner .Description ;
18
21
import org .stringtemplate .v4 .ST ;
19
22
20
23
import java .io .File ;
@@ -46,6 +49,17 @@ public class BaseNodeTest implements RuntimeTestSupport {
46
49
/** Errors found while running antlr */
47
50
protected StringBuilder antlrToolErrors ;
48
51
52
+ @ org .junit .Rule
53
+ public final TestRule testWatcher = new TestWatcher () {
54
+
55
+ @ Override
56
+ protected void succeeded (Description description ) {
57
+ // remove tmpdir if no error.
58
+ eraseTempDir ();
59
+ }
60
+
61
+ };
62
+
49
63
@ Override
50
64
public void testSetUp () throws Exception {
51
65
// new output dir for each test
Original file line number Diff line number Diff line change 30
30
import org .antlr .v4 .test .runtime .StreamVacuum ;
31
31
import org .antlr .v4 .tool .Grammar ;
32
32
import org .antlr .v4 .tool .LexerGrammar ;
33
+ import org .junit .rules .TestRule ;
34
+ import org .junit .rules .TestWatcher ;
35
+ import org .junit .runner .Description ;
33
36
import org .stringtemplate .v4 .ST ;
34
37
35
38
import static org .antlr .v4 .test .runtime .BaseRuntimeTest .antlrOnString ;
@@ -53,6 +56,17 @@ public class BasePHPTest implements RuntimeTestSupport {
53
56
*/
54
57
protected StringBuilder antlrToolErrors ;
55
58
59
+ @ org .junit .Rule
60
+ public final TestRule testWatcher = new TestWatcher () {
61
+
62
+ @ Override
63
+ protected void succeeded (Description description ) {
64
+ // remove tmpdir if no error.
65
+ eraseTempDir ();
66
+ }
67
+
68
+ };
69
+
56
70
private String getPropertyPrefix () {
57
71
return "antlr-php" ;
58
72
}
Original file line number Diff line number Diff line change 11
11
import org .antlr .v4 .test .runtime .RuntimeTestDescriptor ;
12
12
import org .antlr .v4 .test .runtime .RuntimeTestSupport ;
13
13
import org .antlr .v4 .test .runtime .StreamVacuum ;
14
+ import org .junit .rules .TestRule ;
15
+ import org .junit .rules .TestWatcher ;
16
+ import org .junit .runner .Description ;
14
17
import org .stringtemplate .v4 .ST ;
15
18
16
19
import java .io .BufferedReader ;
@@ -96,6 +99,17 @@ public void run() {
96
99
*/
97
100
private final Set <String > sourceFiles = new HashSet <>();
98
101
102
+ @ org .junit .Rule
103
+ public final TestRule testWatcher = new TestWatcher () {
104
+
105
+ @ Override
106
+ protected void succeeded (Description description ) {
107
+ // remove tmpdir if no error.
108
+ eraseTempDir ();
109
+ }
110
+
111
+ };
112
+
99
113
@ Override
100
114
public void testSetUp () throws Exception {
101
115
// new output dir for each test
You can’t perform that action at this time.
0 commit comments