diff options
author | Evgeny Mandrikov <138671+Godin@users.noreply.github.com> | 2021-03-16 11:43:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 11:43:27 +0100 |
commit | faa8b7ad2ced6a3f2de8adcca8fd5a0626d64d91 (patch) | |
tree | 0b770143741366524ac610eea7e02f0d4b49efd0 /org.jacoco.core.test/src/org/jacoco/core | |
parent | d9296f7251f99a9b0b6e624d7eb6d35021279ce3 (diff) | |
download | jacoco-faa8b7ad2ced6a3f2de8adcca8fd5a0626d64d91.tar.gz |
Fix parsing of SMAP for Kotlin 1.5 (#1164)
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core')
-rw-r--r-- | org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilterTest.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilterTest.java b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilterTest.java index 1824cfc3..beb49816 100644 --- a/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilterTest.java +++ b/org.jacoco.core.test/src/org/jacoco/core/internal/analysis/filter/KotlinInlineFilterTest.java @@ -163,6 +163,47 @@ public class KotlinInlineFilterTest extends FilterTestBase { assertIgnored(expectedRanges.toArray(new Range[0])); } + /** + * See <a href="https://youtrack.jetbrains.com/issue/KT-37704">KT-37704</a> + * + * <pre> + * inline fun f() {} + * fun g() = f() + * </pre> + */ + @Test + public void should_filter_without_parsing_KotlinDebug_stratum() { + context.sourceFileName = "Example.kt"; + context.sourceDebugExtension = "" // + + "SMAP\n" // + + "Example.kt\n" // OutputFileName=Example.kt + + "Kotlin\n" // DefaultStratumId=Kotlin + + "*S Kotlin\n" // StratumID=Kotlin + + "*F\n" // FileSection + + "+ 1 Example.kt\n" // FileID=1,FileName=Example.kt + + "ExampleKt\n" // + + "*L\n" // LineSection + + "1#1,3:1\n" // InputStartLine=1,LineFileID=1,RepeatCount=3,OutputStartLine=1 + + "1#1:4\n" // InputStartLine=1,LineFileID=1,OutputStartLine=4 + + "*S KotlinDebug\n"; // StratumID=KotlinDebug + context.classAnnotations + .add(KotlinGeneratedFilter.KOTLIN_METADATA_DESC); + + m.visitLineNumber(2, new Label()); + m.visitInsn(Opcodes.ICONST_0); + m.visitVarInsn(Opcodes.ISTORE, 0); + m.visitLineNumber(4, new Label()); + shouldIgnorePrevious(m); + m.visitInsn(Opcodes.NOP); + shouldIgnorePrevious(m); + m.visitLineNumber(3, new Label()); + m.visitInsn(Opcodes.RETURN); + + filter.filter(m, context, output); + + assertIgnored(expectedRanges.toArray(new Range[0])); + } + @Test public void should_not_parse_SourceDebugExtension_attribute_when_no_kotlin_metadata_annotation() { context.sourceDebugExtension = "SMAP"; |