From c8a1b71e17805f8053c6a95448da44ecfcf64830 Mon Sep 17 00:00:00 2001 From: Xanonymous Date: Fri, 2 Aug 2024 03:15:44 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20concurrent=20test=20will?= =?UTF-8?q?=20access=20same=20test=20resource?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/test/kotlin/shared/RealWorldTrees.kt | 108 +++++++++--------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/core/src/test/kotlin/shared/RealWorldTrees.kt b/core/src/test/kotlin/shared/RealWorldTrees.kt index b42d157..cfd71c7 100644 --- a/core/src/test/kotlin/shared/RealWorldTrees.kt +++ b/core/src/test/kotlin/shared/RealWorldTrees.kt @@ -1,6 +1,7 @@ package shared import helpers.gumTree +import tw.xcc.gumtree.model.GumTree /** * The real-world tree 1. @@ -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. @@ -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 \ No newline at end of file +internal val realTree1: Pair + get() = realTree1L to realTree1R \ No newline at end of file