* improve test method names in helpers_pathsTests by means of backtick syntax

This commit is contained in:
meisl 2021-08-02 15:47:42 +02:00
parent f0c150d93b
commit bd6c60cf8a

View File

@ -10,7 +10,7 @@ import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertThrows
import kotlin.io.path.* import kotlin.io.path.*
import kotlin.test.assertContains
// Do not move into folder helpers/! // Do not move into folder helpers/!
// This folder is also used by compiler/test // This folder is also used by compiler/test
@ -26,21 +26,21 @@ class PathsHelpersTests {
inner class WithOnePathArg { inner class WithOnePathArg {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
val path = fixturesDir.div("i_do_not_exist") val path = fixturesDir.div("i_do_not_exist")
assertThat("should return the path", assertThat("should return the path",
assumeNotExists(path), `is`(path)) assumeNotExists(path), `is`(path))
} }
@Test @Test
fun testOnExistingFile() { fun `on existing file`() {
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeNotExists(fixturesDir.div("simple_main.p8")) assumeNotExists(fixturesDir.div("simple_main.p8"))
} }
} }
@Test @Test
fun testOnExistingDirectory() { fun `on existing directory`() {
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeNotExists(fixturesDir) assumeNotExists(fixturesDir)
} }
@ -51,14 +51,14 @@ class PathsHelpersTests {
inner class WithOneStringArg { inner class WithOneStringArg {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
val path = fixturesDir.div("i_do_not_exist") val path = fixturesDir.div("i_do_not_exist")
assertThat("should return the path", assertThat("should return the path",
assumeNotExists("$path"), `is`(path)) assumeNotExists("$path"), `is`(path))
} }
@Test @Test
fun testOnExistingFile() { fun `on existing file`() {
val path = fixturesDir.div("simple_main.p8") val path = fixturesDir.div("simple_main.p8")
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeNotExists("$path") assumeNotExists("$path")
@ -66,7 +66,7 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnExistingDirectory() { fun `on existing directory`() {
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeNotExists("$fixturesDir") assumeNotExists("$fixturesDir")
} }
@ -77,21 +77,21 @@ class PathsHelpersTests {
inner class WithPathAndStringArgs { inner class WithPathAndStringArgs {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
val path = fixturesDir.div("i_do_not_exist") val path = fixturesDir.div("i_do_not_exist")
assertThat("should return the path", assertThat("should return the path",
assumeNotExists(fixturesDir, "i_do_not_exist"), `is`(path)) assumeNotExists(fixturesDir, "i_do_not_exist"), `is`(path))
} }
@Test @Test
fun testOnExistingFile() { fun `on existing file`() {
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeNotExists(fixturesDir, "simple_main.p8") assumeNotExists(fixturesDir, "simple_main.p8")
} }
} }
@Test @Test
fun testOnExistingDirectory() { fun `on existing directory`() {
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeNotExists(fixturesDir, "..") assumeNotExists(fixturesDir, "..")
} }
@ -105,7 +105,7 @@ class PathsHelpersTests {
@Nested @Nested
inner class WithOnePathArg { inner class WithOnePathArg {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
val path = fixturesDir.div("i_do_not_exist") val path = fixturesDir.div("i_do_not_exist")
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory(path) assumeDirectory(path)
@ -113,7 +113,7 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnExistingFile() { fun `on existing file`() {
val path = fixturesDir.div("simple_main.p8") val path = fixturesDir.div("simple_main.p8")
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory(path) assumeDirectory(path)
@ -121,7 +121,7 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnExistingDirectory() { fun `on existing directory`() {
val path = workingDir val path = workingDir
assertThat("should return the path", assumeDirectory(path), `is`(path)) assertThat("should return the path", assumeDirectory(path), `is`(path))
} }
@ -130,7 +130,7 @@ class PathsHelpersTests {
@Nested @Nested
inner class WithOneStringArg { inner class WithOneStringArg {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
val path = fixturesDir.div("i_do_not_exist") val path = fixturesDir.div("i_do_not_exist")
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory("$path") assumeDirectory("$path")
@ -138,7 +138,7 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnExistingFile() { fun `on existing file`() {
val path = fixturesDir.div("simple_main.p8") val path = fixturesDir.div("simple_main.p8")
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory("$path") assumeDirectory("$path")
@ -146,7 +146,7 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnExistingDirectory() { fun `on existing directory`() {
val path = workingDir val path = workingDir
assertThat("should return the path", assertThat("should return the path",
assumeDirectory("$path"), `is`(path)) assumeDirectory("$path"), `is`(path))
@ -156,21 +156,21 @@ class PathsHelpersTests {
@Nested @Nested
inner class WithPathAndStringArgs { inner class WithPathAndStringArgs {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory(fixturesDir, "i_do_not_exist") assumeDirectory(fixturesDir, "i_do_not_exist")
} }
} }
@Test @Test
fun testOnExistingFile() { fun `on existing file`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory(fixturesDir, "simple_main.p8") assumeDirectory(fixturesDir, "simple_main.p8")
} }
} }
@Test @Test
fun testOnExistingDirectory() { fun `on existing directory`() {
val path = workingDir.div("..") val path = workingDir.div("..")
assertThat( assertThat(
"should return resulting path", "should return resulting path",
@ -182,21 +182,21 @@ class PathsHelpersTests {
@Nested @Nested
inner class WithStringAndStringArgs { inner class WithStringAndStringArgs {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory("$fixturesDir", "i_do_not_exist") assumeDirectory("$fixturesDir", "i_do_not_exist")
} }
} }
@Test @Test
fun testOnExistingFile() { fun `on existing file`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory("$fixturesDir", "simple_main.p8") assumeDirectory("$fixturesDir", "simple_main.p8")
} }
} }
@Test @Test
fun testOnExistingDirectory() { fun `on existing directory`() {
val path = workingDir.div("..") val path = workingDir.div("..")
assertThat( assertThat(
"should return resulting path", "should return resulting path",
@ -208,21 +208,21 @@ class PathsHelpersTests {
@Nested @Nested
inner class WithStringAndPathArgs { inner class WithStringAndPathArgs {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory("$fixturesDir", Path("i_do_not_exist")) assumeDirectory("$fixturesDir", Path("i_do_not_exist"))
} }
} }
@Test @Test
fun testOnExistingFile() { fun `on existing file`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeDirectory("$fixturesDir", Path("simple_main.p8")) assumeDirectory("$fixturesDir", Path("simple_main.p8"))
} }
} }
@Test @Test
fun testOnExistingDirectory() { fun `on existing directory`() {
val path = workingDir.div("..") val path = workingDir.div("..")
assertThat( assertThat(
"should return resulting path", "should return resulting path",
@ -239,7 +239,7 @@ class PathsHelpersTests {
inner class WithOnePathArg { inner class WithOnePathArg {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
val path = fixturesDir.div("i_do_not_exist") val path = fixturesDir.div("i_do_not_exist")
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeReadableFile(path) assumeReadableFile(path)
@ -247,14 +247,14 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnReadableFile() { fun `on readable file`() {
val path = fixturesDir.div("simple_main.p8") val path = fixturesDir.div("simple_main.p8")
assertThat("should return the path", assertThat("should return the path",
assumeReadableFile(path), `is`(path)) assumeReadableFile(path), `is`(path))
} }
@Test @Test
fun testOnDirectory() { fun `on directory`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeReadableFile(fixturesDir) assumeReadableFile(fixturesDir)
} }
@ -265,7 +265,7 @@ class PathsHelpersTests {
inner class WithOneStringArg { inner class WithOneStringArg {
@Test @Test
fun testOnNonExistingPath() { fun `on non-existing path`() {
val path = fixturesDir.div("i_do_not_exist") val path = fixturesDir.div("i_do_not_exist")
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeReadableFile("$path") assumeReadableFile("$path")
@ -273,14 +273,14 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnReadableFile() { fun `on readable file`() {
val path = fixturesDir.div("simple_main.p8") val path = fixturesDir.div("simple_main.p8")
assertThat("should return the resulting path", assertThat("should return the resulting path",
assumeReadableFile("$path"), `is`(path)) assumeReadableFile("$path"), `is`(path))
} }
@Test @Test
fun testOnDirectory() { fun `on directory`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeReadableFile("$fixturesDir") assumeReadableFile("$fixturesDir")
} }
@ -290,21 +290,21 @@ class PathsHelpersTests {
@Nested @Nested
inner class WithPathAndStringArgs { inner class WithPathAndStringArgs {
@Test @Test
fun testOnNonexistingPath() { fun `on non-existing path`() {
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeReadableFile(fixturesDir, "i_do_not_exist") assumeReadableFile(fixturesDir, "i_do_not_exist")
} }
} }
@Test @Test
fun testOnReadableFile() { fun `on readable file`() {
val path = fixturesDir.div("simple_main.p8") val path = fixturesDir.div("simple_main.p8")
assertThat("should return the resulting path", assertThat("should return the resulting path",
assumeReadableFile(fixturesDir, "simple_main.p8"), `is`(path)) assumeReadableFile(fixturesDir, "simple_main.p8"), `is`(path))
} }
@Test @Test
fun testOnDirectory() { fun `on directory`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeReadableFile(fixturesDir, "..") assumeReadableFile(fixturesDir, "..")
} }
@ -314,13 +314,13 @@ class PathsHelpersTests {
@Nested @Nested
inner class WithPathAndPathArgs { inner class WithPathAndPathArgs {
@Test @Test
fun testOnNonexistingPath() { fun `on non-existing path`() {
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeReadableFile(fixturesDir, Path("i_do_not_exist")) assumeReadableFile(fixturesDir, Path("i_do_not_exist"))
} }
} }
@Test fun testOnReadableFile() { @Test fun `on readable file`() {
assertThat("should return the resulting path", assertThat("should return the resulting path",
assumeReadableFile(fixturesDir, Path("simple_main.p8")), assumeReadableFile(fixturesDir, Path("simple_main.p8")),
`is`(fixturesDir.div("simple_main.p8")) `is`(fixturesDir.div("simple_main.p8"))
@ -328,7 +328,7 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnDirectory() { fun `on directory`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeReadableFile(fixturesDir, Path("..")) assumeReadableFile(fixturesDir, Path(".."))
} }
@ -338,14 +338,14 @@ class PathsHelpersTests {
@Nested @Nested
inner class WithStringAndStringArgs { inner class WithStringAndStringArgs {
@Test @Test
fun testOnNonexistingPath() { fun `on non-existing path`() {
assertThrows<java.lang.AssertionError> { assertThrows<java.lang.AssertionError> {
assumeReadableFile("$fixturesDir", "i_do_not_exist") assumeReadableFile("$fixturesDir", "i_do_not_exist")
} }
} }
@Test @Test
fun testOnReadableFile() { fun `on readable file`() {
assertThat("should return the resulting path", assertThat("should return the resulting path",
assumeReadableFile(fixturesDir.toString(), "simple_main.p8"), assumeReadableFile(fixturesDir.toString(), "simple_main.p8"),
`is`(fixturesDir.div("simple_main.p8")) `is`(fixturesDir.div("simple_main.p8"))
@ -353,7 +353,7 @@ class PathsHelpersTests {
} }
@Test @Test
fun testOnDirectory() { fun `on directory`() {
assertThrows<AssertionError> { assertThrows<AssertionError> {
assumeReadableFile("$fixturesDir", "..") assumeReadableFile("$fixturesDir", "..")
} }