aboutsummaryrefslogtreecommitdiff
path: root/app/src/test/kotlin/com/pitchedapps/frost
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps/frost')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/Base.java10
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/parsers/MessageParserTest.kt5
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/parsers/ParserTestHelper.kt10
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/parsers/SearchParserTest.kt18
4 files changed, 26 insertions, 17 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/Base.java b/app/src/test/kotlin/com/pitchedapps/frost/Base.java
deleted file mode 100644
index 42a7da48..00000000
--- a/app/src/test/kotlin/com/pitchedapps/frost/Base.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.pitchedapps.frost;
-
-/**
- * Created by Allan Wang on 2017-10-06.
- *
- * Empty class to hold a reference to the target output
- */
-
-public class Base {
-}
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/parsers/MessageParserTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/parsers/MessageParserTest.kt
index dfdf8cc2..91f765cc 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/parsers/MessageParserTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/parsers/MessageParserTest.kt
@@ -10,10 +10,7 @@ import kotlin.test.assertEquals
class MessageParserTest {
@Test
- fun basic() {
- val content = getResource("priv/messages.html") ?: return
- println(MessageParser.debug(content))
- }
+ fun basic() = debug("messages", MessageParser)
@Test
fun parseEpoch() {
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/parsers/ParserTestHelper.kt b/app/src/test/kotlin/com/pitchedapps/frost/parsers/ParserTestHelper.kt
index 78050439..be5ac624 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/parsers/ParserTestHelper.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/parsers/ParserTestHelper.kt
@@ -1,18 +1,22 @@
package com.pitchedapps.frost.parsers
-import com.pitchedapps.frost.Base
import java.net.URL
import java.nio.file.Paths
/**
* Created by Allan Wang on 2017-10-06.
*/
- fun <T : Any> T.getResource(path: String): String? {
+fun <T : Any> T.getResource(path: String): String? {
Paths.get("src/test/resources/${path.trimStart('/')}")
- val resource: URL? = Base::class.java.classLoader.getResource(path)
+ val resource: URL? = this::class.java.classLoader.getResource(path)
if (resource == null) {
println("Resource at $path could not be found")
return null
}
return resource.readText()
+}
+
+fun <T : Any, P : Any> T.debug(path: String, parser: FrostParser<P>) {
+ val content = getResource("priv/$path.html") ?: return
+ println(parser.debug(content))
} \ No newline at end of file
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/parsers/SearchParserTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/parsers/SearchParserTest.kt
new file mode 100644
index 00000000..6a7b60ae
--- /dev/null
+++ b/app/src/test/kotlin/com/pitchedapps/frost/parsers/SearchParserTest.kt
@@ -0,0 +1,18 @@
+package com.pitchedapps.frost.parsers
+
+import org.junit.Test
+
+/**
+ * Created by Allan Wang on 2017-10-06.
+ */
+class SearchParserTest {
+
+ @Test
+ fun debug() = debug("search", SearchParser)
+
+ @Test
+ fun debug2() = debug("search2", SearchParser)
+
+ @Test
+ fun debug3() = debug("search3", SearchParser)
+} \ No newline at end of file