19
19
20
20
package org.ossreviewtoolkit.plugins.packagemanagers.carthage
21
21
22
- import io.kotest.assertions.throwables.shouldThrow
23
22
import io.kotest.core.spec.style.WordSpec
24
23
import io.kotest.core.test.TestCase
25
24
import io.kotest.engine.test.TestResult
25
+ import io.kotest.matchers.collections.beEmpty
26
+ import io.kotest.matchers.collections.shouldBeSingleton
27
+ import io.kotest.matchers.should
26
28
import io.kotest.matchers.shouldBe
29
+ import io.kotest.matchers.string.shouldContain
27
30
28
31
import io.mockk.every
29
32
import io.mockk.mockkStatic
@@ -32,9 +35,8 @@ import io.mockk.unmockkAll
32
35
import java.io.File
33
36
import java.net.URI
34
37
38
+ import org.ossreviewtoolkit.analyzer.resolveSingleProject
35
39
import org.ossreviewtoolkit.model.VcsType
36
- import org.ossreviewtoolkit.model.config.AnalyzerConfiguration
37
- import org.ossreviewtoolkit.model.config.Excludes
38
40
39
41
class CarthageTest : WordSpec () {
40
42
private val carthage = CarthageFactory .create()
@@ -48,7 +50,7 @@ class CarthageTest : WordSpec() {
48
50
" parse a github dependency" {
49
51
val cartfile = File (" src/test/assets/Cartfile-github.resolved" )
50
52
51
- val result = carthage.resolveDependencies (cartfile).single( )
53
+ val result = carthage.resolveSingleProject (cartfile)
52
54
53
55
with (result.packages) {
54
56
size shouldBe 1
@@ -63,7 +65,7 @@ class CarthageTest : WordSpec() {
63
65
" parse a generic git dependency" {
64
66
val cartfile = File (" src/test/assets/Cartfile-generic-git.resolved" )
65
67
66
- val result = carthage.resolveDependencies (cartfile).single( )
68
+ val result = carthage.resolveSingleProject (cartfile)
67
69
68
70
with (result.packages) {
69
71
size shouldBe 1
@@ -83,7 +85,7 @@ class CarthageTest : WordSpec() {
83
85
84
86
val cartfile = File (" src/test/assets/Cartfile-binary.resolved" )
85
87
86
- val result = carthage.resolveDependencies (cartfile).single( )
88
+ val result = carthage.resolveSingleProject (cartfile)
87
89
with (result.packages) {
88
90
size shouldBe 1
89
91
single().apply {
@@ -101,7 +103,7 @@ class CarthageTest : WordSpec() {
101
103
102
104
val cartfile = File (" src/test/assets/Cartfile-mixed.resolved" )
103
105
104
- val result = carthage.resolveDependencies (cartfile).single( )
106
+ val result = carthage.resolveSingleProject (cartfile)
105
107
106
108
with (result.packages) {
107
109
size shouldBe 3
@@ -118,13 +120,13 @@ class CarthageTest : WordSpec() {
118
120
" throw an error for a wrongly defined dependency" {
119
121
val cartfile = File (" src/test/assets/Cartfile-faulty.resolved" )
120
122
121
- shouldThrow<IllegalArgumentException > {
122
- carthage.resolveDependencies(cartfile)
123
+ val result = carthage.resolveSingleProject(cartfile)
124
+
125
+ result.packages should beEmpty()
126
+ result.issues.shouldBeSingleton {
127
+ it.message shouldContain " IllegalArgumentException"
123
128
}
124
129
}
125
130
}
126
131
}
127
132
}
128
-
129
- private fun Carthage.resolveDependencies (definitionFile : File ) =
130
- resolveDependencies(definitionFile.parentFile, definitionFile, Excludes .EMPTY , AnalyzerConfiguration (), emptyMap())
0 commit comments