Skip to content

Commit

Permalink
Updated junit lib
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er committed Jun 22, 2022
1 parent a1fa896 commit 6b3bc83
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion transpiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package org.polystat.py2eo.transpiler

import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runners.MethodSorters

import java.io.File
import java.nio.file.{Files, StandardCopyOption}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.Duration
import scala.concurrent.{Await, Future}
import scala.reflect.io.Directory
import scala.sys.process.Process


@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class DjangoTest extends Commons {

@Test
def genUnsupportedDjango(): Unit = {
@Test def firstlyGenUnsupportedDjango(): Unit = {
val root = Directory(testsPrefix)
val djangoDir = Directory(root / "django")
if (!djangoDir.exists) {
Expand All @@ -31,4 +34,32 @@ class DjangoTest extends Commons {

for (f <- futures) Await.result(f, Duration.Inf)
}

@Test def secondlyCheckSyntaxForDjango() : Unit = {
val django = new File("/tmp/django")
val eopaths = Files.walk(django.toPath).filter(f => f.endsWith("genUnsupportedEO"))
val futures = eopaths.map(path =>
Future {
val from = new File(testsPrefix + "/django-pom.xml").toPath
val to = new File(path.toString + "/pom.xml").toPath
println(s"$from -> $to")
Files.copy(from, to, StandardCopyOption.REPLACE_EXISTING)
assert(0 == Process(
s"cp -a '$testsPrefix/../../../../../../main/eo/preface/' ${path.toString}"
).!
)
assert(0 == Process("mvn clean test", path.toFile).!)
assert(0 == Process(s"rm -rf ${path.toString}").!)
// val stdout = new StringBuilder
// val stderr = new StringBuilder
// val exitCode = Process("mvn clean test", path.toFile) ! ProcessLogger(stdout append _, stderr append _)
// if (0 != exitCode) {
// println(s"for path $to stdout is \n $stdout\n stderr is \n $stderr\n")
// } else {
// assert(0 == Process(s"rm -rf ${path.toString}").!)
// }
}
)
futures.forEach(f => Await.result(f, Duration.Inf))
}
}

0 comments on commit 6b3bc83

Please sign in to comment.