@@ -240,7 +240,7 @@ class PluginCoverageTest
240
240
compiler.assertNMeasuredStatements(3 )
241
241
}
242
242
243
- test(" scoverage should support yields" ) {
243
+ test(" plugin should support yields" ) {
244
244
val compiler = ScoverageCompiler .default
245
245
compiler.compileCodeSnippet( """
246
246
| object Yielder {
@@ -255,7 +255,7 @@ class PluginCoverageTest
255
255
compiler.assertNMeasuredStatements(11 )
256
256
}
257
257
258
- test(" scoverage should not instrument local macro implementation" ) {
258
+ test(" plugin should not instrument local macro implementation" ) {
259
259
val compiler = ScoverageCompiler .default
260
260
compiler.compileCodeSnippet( """
261
261
| object MyMacro {
@@ -273,8 +273,7 @@ class PluginCoverageTest
273
273
compiler.assertNoCoverage()
274
274
}
275
275
276
- // https://github.com/skinny-framework/skinny-framework/issues/97
277
- test(" scoverage should not instrument expanded macro code" ) {
276
+ test(" plugin should not instrument expanded macro code github.com/skinny-framework/skinny-framework/issues/97" ) {
278
277
val compiler = ScoverageCompiler .default
279
278
compiler.addToClassPath(" org.slf4j" , " slf4j-api" , " 1.7.7" )
280
279
compiler
@@ -293,4 +292,28 @@ class PluginCoverageTest
293
292
assert(! compiler.reporter.hasWarnings)
294
293
compiler.assertNoCoverage()
295
294
}
295
+
296
+ test(" plugin should handle return inside catch github.com/scoverage/scalac-scoverage-plugin/issues/93" ) {
297
+ val compiler = ScoverageCompiler .default
298
+ compiler.compileCodeSnippet(
299
+ """
300
+ | object bob {
301
+ | def fail(): Boolean = {
302
+ | try {
303
+ | true
304
+ | } catch {
305
+ | case _: Throwable =>
306
+ | Option(true) match {
307
+ | case Some(bool) => return bool // comment this return and instrumentation succeeds
308
+ | case _ =>
309
+ | }
310
+ | false
311
+ | }
312
+ | }
313
+ | }
314
+ """ .stripMargin)
315
+ assert(! compiler.reporter.hasErrors)
316
+ assert(! compiler.reporter.hasWarnings)
317
+ compiler.assertNMeasuredStatements(11 )
318
+ }
296
319
}
0 commit comments