Skip to content

Commit

Permalink
fix: 🐛 concurrent test will access same test resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanonymous-GitHub committed Aug 2, 2024
1 parent c07dd9b commit c8a1b71
Showing 1 changed file with 56 additions and 52 deletions.
108 changes: 56 additions & 52 deletions core/src/test/kotlin/shared/RealWorldTrees.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package shared

import helpers.gumTree
import tw.xcc.gumtree.model.GumTree

/**
* The real-world tree 1.
Expand All @@ -14,35 +15,36 @@ import helpers.gumTree
* }
* ```
* */
private val realTree1L =
gumTree("CompilationUnit") {
child("TypeDeclaration") {
child("Modifier", "public")
child("SimpleName", "Test")
child("MethodDeclaration") {
private val realTree1L: GumTree
get() =
gumTree("CompilationUnit") {
child("TypeDeclaration") {
child("Modifier", "public")
child("SimpleType", "String") {
child("SimpleName", "String")
}
child("SimpleName", "foo")
child("SingleVariableDeclaration") {
child("PrimitiveType", "int")
child("SimpleName", "i")
}
child("Block") {
child("IfStatement") {
child("InfixExpression", "==") {
child("SimpleName", "i")
child("NumberLiteral", "0")
}
child("ReturnStatement") {
child("StringLiteral", "Foo!")
child("SimpleName", "Test")
child("MethodDeclaration") {
child("Modifier", "public")
child("SimpleType", "String") {
child("SimpleName", "String")
}
child("SimpleName", "foo")
child("SingleVariableDeclaration") {
child("PrimitiveType", "int")
child("SimpleName", "i")
}
child("Block") {
child("IfStatement") {
child("InfixExpression", "==") {
child("SimpleName", "i")
child("NumberLiteral", "0")
}
child("ReturnStatement") {
child("StringLiteral", "Foo!")
}
}
}
}
}
}
}

/**
* The real-world tree 1.
Expand All @@ -57,49 +59,51 @@ private val realTree1L =
* }
* ```
*/
private val realTree1R =
gumTree("CompilationUnit") {
child("TypeDeclaration") {
child("Modifier", "public")
child("SimpleName", "Test")
child("MethodDeclaration") {
private val realTree1R: GumTree
get() =
gumTree("CompilationUnit") {
child("TypeDeclaration") {
child("Modifier", "public")
child("SimpleType", "String") {
child("SimpleName", "String")
}
child("SimpleName", "foo")
child("SingleVariableDeclaration") {
child("PrimitiveType", "int")
child("SimpleName", "i")
}
child("Block") {
child("IfStatement") {
child("InfixExpression", "==") {
child("SimpleName", "i")
child("NumberLiteral", "0")
}
child("ReturnStatement") {
child("StringLiteral", "Bar")
}
child("SimpleName", "Test")
child("MethodDeclaration") {
child("Modifier", "public")
child("SimpleType", "String") {
child("SimpleName", "String")
}
child("SimpleName", "foo")
child("SingleVariableDeclaration") {
child("PrimitiveType", "int")
child("SimpleName", "i")
}
child("Block") {
child("IfStatement") {
child("InfixExpression", "==") {
child("SimpleName", "i")
child("PrefixExpression", "-") {
child("NumberLiteral", "1")
}
child("NumberLiteral", "0")
}
child("ReturnStatement") {
child("StringLiteral", "Foo!")
child("StringLiteral", "Bar")
}
child("IfStatement") {
child("InfixExpression", "==") {
child("SimpleName", "i")
child("PrefixExpression", "-") {
child("NumberLiteral", "1")
}
}
child("ReturnStatement") {
child("StringLiteral", "Foo!")
}
}
}
}
}
}
}
}

/**
* @see realTree1L
* @see realTree1R
* */
internal val realTree1 = realTree1L to realTree1R
internal val realTree1: Pair<GumTree, GumTree>
get() = realTree1L to realTree1R

0 comments on commit c8a1b71

Please sign in to comment.