Skip to content

Commit

Permalink
#29 correct temp directory deletion in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed Oct 12, 2023
1 parent a340e9f commit d77573f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.idea
*.iml
target
tmp*
*_deog
*tmp
*TMP
*eo_outputs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ import java.nio.file.Paths
*/
open class AttrBase : TestBase {
private val logger = LoggerFactory.getLogger(this.javaClass.name)
private var postfix = "tmp"

override fun doTest() {
val path = getTestName()
val sources = SrsTransformed(Path.of(constructInPath(path)), XslTransformer(), "tmp")
val sources = SrsTransformed(Path.of(constructInPath(path)), XslTransformer(), postfix)
val graph = GraphBuilder(sources.walk()).createGraph()
val attributesSetter = AttributesSetter(graph)
attributesSetter.setAttributes()
Expand All @@ -59,7 +60,7 @@ open class AttrBase : TestBase {
checkOutput(expected, actual)
try {
val tmpDir =
Paths.get("${constructInPath(path).replace('/', sep).substringBeforeLast(sep)}${sep}TMP").toString()
Paths.get("${constructInPath(path)}_$postfix").toString()
FileUtils.deleteDirectory(File(tmpDir))
} catch (e: Exception) {
logger.error(e.printStackTrace().toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ import java.nio.file.Paths
*/
open class BuilderBase : TestBase {
private val logger = LoggerFactory.getLogger(this.javaClass.name)
private val postfix = "tmp"

override fun doTest() {
val path = getTestName()
val sources = SrsTransformed(Path.of(constructInPath(path)), XslTransformer(), "tmp")
val sources = SrsTransformed(Path.of(constructInPath(path)), XslTransformer(), postfix)
val graph = GraphBuilder(sources.walk()).createGraph()
val out = ByteArrayOutputStream()
graph.heads.sortedBy { it.name }.forEach { printOut(it, out, mutableSetOf()) }
Expand All @@ -56,7 +57,7 @@ open class BuilderBase : TestBase {
checkOutput(expected, actual)
try {
val tmpDir =
Paths.get("${constructInPath(path).replace('/', sep).substringBeforeLast(sep)}${sep}TMP").toString()
Paths.get("${constructInPath(path)}_$postfix").toString()
FileUtils.deleteDirectory(File(tmpDir))
} catch (e: Exception) {
logger.error(e.printStackTrace().toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ import java.nio.file.Paths
*/
open class InnerBase : TestBase {
private val logger = LoggerFactory.getLogger(this.javaClass.name)
private val postfix = "tmp"

override fun doTest() {
val path = getTestName()
val sources = SrsTransformed(Path.of(constructInPath(path)), XslTransformer(), "tmp")
val sources = SrsTransformed(Path.of(constructInPath(path)), XslTransformer(), postfix)
val graph = GraphBuilder(sources.walk()).createGraph()
val attributesSetter = AttributesSetter(graph)
attributesSetter.setAttributes()
Expand All @@ -62,7 +63,7 @@ open class InnerBase : TestBase {
checkOutput(expected, actual)
try {
val tmpDir =
Paths.get("${constructInPath(path).replace('/', sep).substringBeforeLast(sep)}${sep}TMP").toString()
Paths.get("${constructInPath(path)}_$postfix").toString()
FileUtils.deleteDirectory(File(tmpDir))
} catch (e: Exception) {
logger.error(e.printStackTrace().toString())
Expand Down

3 comments on commit d77573f

@0pdd
Copy link

@0pdd 0pdd commented on d77573f Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 29-00ddb084 discovered in src/main/kotlin/org/objectionary/deog/GraphBuilder.kt) and submitted as #34. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link

@0pdd 0pdd commented on d77573f Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 29-67e5e248 discovered in src/main/kotlin/org/objectionary/deog/sources/XslTransformer.kt) and submitted as #35. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

@0pdd
Copy link

@0pdd 0pdd commented on d77573f Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 29-2f329725 discovered in src/test/kotlin/org/objectionary/deog/unit/graph/TestBase.kt) and submitted as #36. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.