Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
soywiz committed Nov 28, 2020
1 parent bbb5d4b commit 088d75e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.soywiz.korio.file.*

fun DynamicRootVfs(base: Vfs, rootGet: () -> String) = DynamicRootVfsVfs(base, rootGet).root

class DynamicRootVfsVfs(val base: Vfs, val rootGet: () -> String) : Vfs.Proxy() {
open class DynamicRootVfsVfs(val base: Vfs, val rootGet: () -> String) : Vfs.Proxy() {
private fun getLocalAbsolutePath(path: String) = rootGet().pathInfo.lightCombine(path.pathInfo).fullPath
override fun getAbsolutePath(path: String): String = base.getAbsolutePath(getLocalAbsolutePath(path))
override suspend fun access(path: String): VfsFile = base[getLocalAbsolutePath(path)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import com.soywiz.korio.util.*
import kotlin.test.*

class UniversalVfsTest {
private val fileIsLocalVfs get() = !OS.isJsBrowser && !OS.isNative

@Test
fun testProperVfsIsResolved() {
if (!OS.isJsBrowser) {
if (fileIsLocalVfs) {
assertTrue("file:///path/to/my/file".uniVfs.vfs is LocalVfs)
}
assertTrue("http://google.es/".uniVfs.vfs is UrlVfs)
Expand All @@ -19,7 +21,7 @@ class UniversalVfsTest {

@Test
fun testProperPathIsResolved() {
if (!OS.isJsBrowser) {
if (fileIsLocalVfs) {
assertEquals("/path/to/my/file", "file:///path/to/my/file".uniVfs.absolutePath)
}
assertEquals("http://google.es/", "http://google.es/".uniVfs.absolutePath)
Expand Down

0 comments on commit 088d75e

Please sign in to comment.