-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
11 changed files
with
95 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...es/resources-gallery/mpp-library/src/commonTest/kotlin/com/icerock/library/AssetsTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package com.icerock.library | ||
|
||
import BaseUnitTest | ||
import com.icerockdev.library.MR | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.test.runTest | ||
import readTextContent | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class AssetsTests : BaseUnitTest() { | ||
|
||
@OptIn(ExperimentalCoroutinesApi::class) | ||
@Test | ||
fun checkAssetRead() = runTest { | ||
assertEquals( | ||
expected = "Text file2 from assets.", | ||
actual = MR.assets.texts.test2_txt.readTextContent() | ||
) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...sources-gallery/mpp-library/test-utils/src/androidMain/kotlin/AssetResourceExt.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import android.content.Context | ||
import androidx.test.core.app.ApplicationProvider | ||
import dev.icerock.moko.resources.AssetResource | ||
|
||
public actual suspend fun AssetResource.readTextContent(): String { | ||
val context: Context = ApplicationProvider.getApplicationContext() | ||
return this.readText(context) | ||
} |
7 changes: 7 additions & 0 deletions
7
samples/resources-gallery/mpp-library/test-utils/src/commonMain/kotlin/AssetResourceExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import dev.icerock.moko.resources.AssetResource | ||
|
||
public expect suspend fun AssetResource.readTextContent(): String |
9 changes: 9 additions & 0 deletions
9
samples/resources-gallery/mpp-library/test-utils/src/iosMain/kotlin/AssetResourceExt.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import dev.icerock.moko.resources.AssetResource | ||
|
||
public actual suspend fun AssetResource.readTextContent(): String { | ||
return this.readText() | ||
} |
9 changes: 9 additions & 0 deletions
9
samples/resources-gallery/mpp-library/test-utils/src/jsMain/kotlin/AssetResourceExt.js.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import dev.icerock.moko.resources.AssetResource | ||
|
||
public actual suspend fun AssetResource.readTextContent(): String { | ||
return this.getText() | ||
} |
9 changes: 9 additions & 0 deletions
9
samples/resources-gallery/mpp-library/test-utils/src/jvmMain/kotlin/AssetResourceExt.jvm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import dev.icerock.moko.resources.AssetResource | ||
|
||
public actual suspend fun AssetResource.readTextContent(): String { | ||
return this.readText() | ||
} |
9 changes: 9 additions & 0 deletions
9
...s/resources-gallery/mpp-library/test-utils/src/macosMain/kotlin/AssetResourceExt.macos.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
import dev.icerock.moko.resources.AssetResource | ||
|
||
public actual suspend fun AssetResource.readTextContent(): String { | ||
return this.readText() | ||
} |