@@ -24,10 +24,11 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
2424 }
2525
2626 final implicit class ImplicitTreeHelper (original : Tree ) {
27+ /** Needs to be executed on the PC thread. */
2728 def printsTo (expectedOutput : String ): Unit = {
2829 val sourceFile = new BatchSourceFile (" noname" , expectedOutput)
2930 val expected = stripWhitespacePreservers(expectedOutput).trim()
30- val actual = ask { () => generate(original, sourceFile = Some (sourceFile)).asText.trim() }
31+ val actual = generate(original, sourceFile = Some (sourceFile)).asText.trim()
3132 if (actual != expected)
3233 throw new ComparisonFailure (" " , expected, actual)
3334 }
@@ -36,15 +37,15 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
3637 def becomes (expectedOutput : String ) = input -> expectedOutput
3738 }
3839 final implicit class OrToDieAfter (input : (String , String )) {
39- def after (trans : Transformation [Tree , Tree ]): Unit = {
40- val t = ask { () => trans(treeFrom(input._1)) }
40+ def after (trans : Transformation [Tree , Tree ]): Unit = ask { () =>
41+ val t = trans(treeFrom(input._1))
4142 require(t.isDefined, " transformation was not successful" )
4243 t foreach (_.printsTo(input._2))
4344 }
4445 }
4546
4647 @ Test
47- def add_return_type_to_def () = global.ask { () => """
48+ def add_return_type_to_def () = """
4849 package add_return_type_to_def
4950 object X {
5051 def value = new java.io.File("")
@@ -57,10 +58,9 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
5758 val newTpt = tpt setOriginal mkReturn(List (tpt.tpe.typeSymbol))
5859 d.copy(tpt = newTpt) replaces d
5960 }}}
60- }
6161
6262 @ Test
63- def add_return_type_to_val () = global.ask { () => """
63+ def add_return_type_to_val () = """
6464 package add_return_type_to_val
6565 object X {
6666 val value = new java.io.File("")
@@ -74,10 +74,9 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
7474 val newTpt = tpt setOriginal mkReturn(List (tpt.tpe.typeSymbol))
7575 d.copy(tpt = newTpt) replaces d
7676 }}}
77- }
7877
7978 @ Test
80- def add_return_type_to_var () = global.ask { () => """
79+ def add_return_type_to_var () = """
8180 package add_return_type_to_var
8281 object X {
8382 var variable = new java.io.File("")
@@ -91,10 +90,9 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
9190 val newTpt = tpt setOriginal mkReturn(List (tpt.tpe.typeSymbol))
9291 d.copy(tpt = newTpt) replaces d
9392 }}}
94- }
9593
9694 @ Test
97- def add_override_flag () = global.ask { () => """
95+ def add_override_flag () = """
9896 package add_override_flag
9997 trait T {
10098 def meth: Int
@@ -120,10 +118,9 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
120118 d.copy(mods = d.mods.withFlag(Flag .OVERRIDE )) replaces d
121119 }
122120 }}
123- }
124121
125122 @ Test
126- def add_override_final_flags_to_lazy_val () = global.ask { () => """
123+ def add_override_final_flags_to_lazy_val () = """
127124 package add_override_final_flags_to_lazy_val
128125 trait T {
129126 def meth: Int
@@ -149,10 +146,9 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
149146 d.copy(mods = d.mods.withFlag(Flag .OVERRIDE ).withFlag(Flag .FINAL ).withFlag(Flag .LAZY ).withFlag(Tokens .VAL )) replaces d
150147 }
151148 }}
152- }
153149
154150 @ Test
155- def add_override_protected_abstract_flag () = global.ask { () => """
151+ def add_override_protected_abstract_flag () = """
156152 package add_override_protected_abstract_flag
157153 trait T {
158154 protected def meth: Int = 0
@@ -178,10 +174,9 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
178174 d.copy(mods = d.mods.withFlag(Flag .ABSTRACT ).withFlag(Flag .OVERRIDE ).withFlag(Flag .PROTECTED )) replaces d
179175 }
180176 }}
181- }
182177
183178 @ Test
184- def add_final_case_flag () = global.ask { () => """
179+ def add_final_case_flag () = """
185180 package add_final_case_flag
186181 class C(i: Int)
187182 """ becomes """
@@ -193,10 +188,9 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
193188 d.copy(mods = d.mods.withFlag(Flag .FINAL ).withFlag(Flag .CASE ).withFlag(Flag .PRIVATE )) replaces d
194189 }
195190 }}
196- }
197191
198192 @ Test
199- def add_modifier_to_def_without_return_type () = global.ask { () => """
193+ def add_modifier_to_def_without_return_type () = """
200194 package add_modifier_to_def_without_return_type
201195 trait T {
202196 def meth: Int
@@ -222,10 +216,9 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
222216 d.copy(mods = d.mods.withFlag(Flag .OVERRIDE )) replaces d
223217 }
224218 }}
225- }
226219
227220 @ Test
228- def add_modifier_to_val_without_return_type () = global.ask { () => """
221+ def add_modifier_to_val_without_return_type () = """
229222 package add_modifier_to_val_without_return_type
230223 trait T {
231224 def meth: Int
@@ -252,5 +245,4 @@ class ReusingPrinterTest extends TestHelper with SilentTracing {
252245 d.copy(mods = d.mods.withFlag(Flag .OVERRIDE )) replaces d
253246 }
254247 }}
255- }
256248}
0 commit comments