Skip to content

Commit caecbea

Browse files
committed
test(go): Factor out testDir
Signed-off-by: Frank Viernau <[email protected]>
1 parent 2c94e3b commit caecbea

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

plugins/package-managers/go/src/funTest/kotlin/GoDepFunTest.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,20 @@ import org.ossreviewtoolkit.utils.test.getAssetFile
3939
import org.ossreviewtoolkit.utils.test.matchExpectedResult
4040

4141
class GoDepFunTest : WordSpec({
42+
val testDir = getAssetFile("projects/synthetic/godep")
43+
4244
"GoDep" should {
4345
"resolve dependencies from a lockfile correctly" {
44-
val definitionFile = getAssetFile("projects/synthetic/godep/lockfile/Gopkg.toml")
45-
val expectedResultFile = getAssetFile("projects/synthetic/godep/lockfile-expected-output.yml")
46+
val definitionFile = testDir.resolve("lockfile/Gopkg.toml")
47+
val expectedResultFile = testDir.resolve("lockfile-expected-output.yml")
4648

4749
val result = create("GoDep").resolveSingleProject(definitionFile)
4850

4951
result.toYaml() should matchExpectedResult(expectedResultFile, definitionFile)
5052
}
5153

5254
"show error if no lockfile is present" {
53-
val definitionFile = getAssetFile("projects/synthetic/godep/no-lockfile/Gopkg.toml")
55+
val definitionFile = testDir.resolve("no-lockfile/Gopkg.toml")
5456

5557
val result = create("GoDep").resolveSingleProject(definitionFile)
5658

@@ -66,7 +68,7 @@ class GoDepFunTest : WordSpec({
6668
}
6769

6870
"invoke the dependency solver if no lockfile is present and allowDynamicVersions is set" {
69-
val definitionFile = getAssetFile("projects/synthetic/godep/no-lockfile/Gopkg.toml")
71+
val definitionFile = testDir.resolve("no-lockfile/Gopkg.toml")
7072

7173
val result = create("GoDep", allowDynamicVersions = true).resolveSingleProject(definitionFile)
7274

@@ -77,17 +79,17 @@ class GoDepFunTest : WordSpec({
7779
}
7880

7981
"import dependencies from Glide" {
80-
val definitionFile = getAssetFile("projects/synthetic/godep/glide/glide.yaml")
81-
val expectedResultFile = getAssetFile("projects/synthetic/godep/glide-expected-output.yml")
82+
val definitionFile = testDir.resolve("glide/glide.yaml")
83+
val expectedResultFile = testDir.resolve("glide-expected-output.yml")
8284

8385
val result = create("GoDep").resolveSingleProject(definitionFile)
8486

8587
result.toYaml() should matchExpectedResult(expectedResultFile, definitionFile)
8688
}
8789

8890
"import dependencies from godeps" {
89-
val definitionFile = getAssetFile("projects/synthetic/godep/godeps/Godeps/Godeps.json")
90-
val expectedResultFile = getAssetFile("projects/synthetic/godep/godeps-expected-output.yml")
91+
val definitionFile = testDir.resolve("godeps/Godeps/Godeps.json")
92+
val expectedResultFile = testDir.resolve("godeps-expected-output.yml")
9193

9294
val result = create("GoDep").resolveSingleProject(definitionFile)
9395

0 commit comments

Comments
 (0)