diff options
author | Allan Wang <me@allanwang.ca> | 2017-10-11 01:51:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-11 01:51:21 -0400 |
commit | fe1df730a180316f76c334879da88515a0150a42 (patch) | |
tree | 49ef0590dfbbb7f01347746a8d1f78e15682346a /app/src/test/kotlin/com/pitchedapps/frost/parsers/ParserTestHelper.kt | |
parent | d12e0697ad34c02a8f16143c4bddbc2a02e7b3dc (diff) | |
download | frost-fe1df730a180316f76c334879da88515a0150a42.tar.gz frost-fe1df730a180316f76c334879da88515a0150a42.tar.bz2 frost-fe1df730a180316f76c334879da88515a0150a42.zip |
Search Parsing (#379)
* Update parser interface and add search parsing
* Add custom jsoup method and search parse method
* Bind new searchview
* Add search view cache
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps/frost/parsers/ParserTestHelper.kt')
-rw-r--r-- | app/src/test/kotlin/com/pitchedapps/frost/parsers/ParserTestHelper.kt | 10 |
1 files changed, 7 insertions, 3 deletions
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 |