Skip to content

Commit

Permalink
Test code generation in correct folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
nomisRev committed Jun 6, 2018
1 parent 14ded90 commit a3f51d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import java.io.File
import java.nio.file.Paths

abstract class APTest(
val pckg: String
private val pckg: String,
private val enforcePackage: Boolean = true
) : StringSpec() {

fun testProcessor(
Expand Down Expand Up @@ -56,10 +57,11 @@ abstract class APTest(
assertThat(compilation)
.succeeded()

generationDir.listFiles().size shouldBe 1
val targetDir = if (enforcePackage) File("${generationDir.absolutePath}/${pckg.replace(".", "/")}") else generationDir
targetDir.listFiles().size shouldBe 1

val expected = File(expectedDir, dest).readText()
val actual = generationDir.listFiles()[0].readText()
val actual = targetDir.listFiles()[0].readText()

actual shouldBe expected

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package arrow.ap.tests
import arrow.renzu.RenzuProcessor
import java.io.File

class RenzuTest : APTest("arrow.ap.objects.renzu") {
class RenzuTest : APTest("arrow.ap.objects.renzu", false) {

init {
testProcessor(AnnotationProcessor(
Expand Down

0 comments on commit a3f51d8

Please sign in to comment.