Skip to content

Commit

Permalink
Merge pull request #120 from tudortimi/fix-crash-when-specifying-test…
Browse files Browse the repository at this point in the history
…-compile-dependency-on-other-source-set

Fix crash when specifying test compile dependency on other source set
  • Loading branch information
tudortimi authored Jul 23, 2023
2 parents 08ea071 + 115b051 commit 8f9f92b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,33 @@ class SVUnitPluginSpec extends Specification {
dummyLog.text.contains "-f ${testProjectDir.root}/build/full_test_xrun_args.f"
}

def "'testWithXrun' uses args file for source set dependency"() {
File testSv = testProjectDir.newFolder('src', 'test', 'sv')

File mainSv = testProjectDir.newFolder('src', 'mocks', 'sv')
new File(mainSv, 'dummy_mocks.sv').createNewFile()

buildFile << """
sourceSets.register('mocks')
dependencies {
testCompile files(genMocksXrunArgsFile.destination)
}
"""

when:
def result = newGradleRunnerWithFakeRunSVunit()
.withProjectDir(testProjectDir.root)
.withPluginClasspath()
.withArguments('testWithXrun')
.build()

then:
result.task(":testWithXrun").outcome == SUCCESS
def testFullXrunArgsFile = new File(testProjectDir.root, 'build/full_test_xrun_args.f')
testFullXrunArgsFile.text.contains "-f ${testProjectDir.root}/build/mocks_xrun_args.f"
}

def "'check' task executes test tasks"() {
File testSv = testProjectDir.newFolder('src', 'test', 'sv')
new File(testSv, 'dummy_test.sv').createNewFile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private void configureSVUnitRootConfiguration(Project project) {
}

private boolean isSVUnit(Dependency dependency) {
return dependency.getGroup().equals("org.svunit") && dependency.getName().equals("svunit");
return "org.svunit".equals(dependency.getGroup()) && "svunit".equals(dependency.getName());
}

private void configureArgsFilesConfiguration(Project project, SourceSet testSourceSet, String toolName) {
Expand Down

0 comments on commit 8f9f92b

Please sign in to comment.