Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CaelmBleidd committed Dec 20, 2024
1 parent a5aed8f commit 703b36c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ class JcSingleInstructionTransformer(originalInstructions: JcInstList<JcInst>) {
}
}

@OptIn(ExperimentalContracts::class)
inline fun MutableList<JcInst>.addInstruction(origin: JcInstLocation, body: (JcInstLocation) -> JcInst) {
contract {
callsInPlace(body, InvocationKind.EXACTLY_ONCE)
}

val index = size
val newLocation = JcInstLocationImpl(origin.method, index, origin.lineNumber)
val instruction = body(newLocation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class QueueUsagesTest : JavaMethodTestRunner() {
eq(4),
{ _, q, r -> q == null && r == 0 },
{ _, q, r -> q is LinkedList<*> && r == 1 },
{ _, q, r -> q is ArrayDeque<*> && r == 2 },
{ _, q, r -> q !is LinkedList<*> && q !is ArrayDeque<*> && r == 3 }
{ _, q, r -> q is java.util.ArrayDeque<*> && r == 2 },
{ _, q, r -> q !is LinkedList<*> && q !is java.util.ArrayDeque<*> && r == 3 }
)
}

Expand All @@ -102,8 +102,8 @@ class QueueUsagesTest : JavaMethodTestRunner() {
eq(4),
{ _, q, r -> q == null && r == 0 },
{ _, q, r -> q is LinkedList<*> && r == 1 },
{ _, q, r -> q is ArrayDeque<*> && r == 2 },
{ _, q, r -> q !is LinkedList<*> && q !is ArrayDeque<*> && r == 3 } // this is uncovered
{ _, q, r -> q is java.util.ArrayDeque<*> && r == 2 },
{ _, q, r -> q !is LinkedList<*> && q !is java.util.ArrayDeque<*> && r == 3 } // this is uncovered
)
}

Expand Down

0 comments on commit 703b36c

Please sign in to comment.