-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more tests to linux target (#205)
- Loading branch information
1 parent
8de9c0f
commit e6e77b1
Showing
5 changed files
with
138 additions
and
3 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
33 changes: 33 additions & 0 deletions
33
sqlite-driver/src/linuxTest/kotlin/base/LinuxDatabaseFactory.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,33 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package ru.pixnews.wasm.sqlite.driver.base | ||
|
||
import androidx.room.Room | ||
import androidx.room.RoomDatabase | ||
import androidx.sqlite.SQLiteDriver | ||
import ru.pixnews.wasm.sqlite.driver.test.base.room.UserDatabaseSuspend | ||
import ru.pixnews.wasm.sqlite.driver.test.base.tests.room.UserDatabaseTests.UserDatabaseFactory | ||
import kotlin.coroutines.CoroutineContext | ||
|
||
class LinuxDatabaseFactory : UserDatabaseFactory { | ||
override fun create( | ||
driver: SQLiteDriver, | ||
databaseName: String?, | ||
queryCoroutineContext: CoroutineContext, | ||
): UserDatabaseSuspend { | ||
val builder = if (databaseName != null) { | ||
Room.databaseBuilder<UserDatabaseSuspend>(databaseName) | ||
} else { | ||
Room.inMemoryDatabaseBuilder<UserDatabaseSuspend>() | ||
} | ||
return builder | ||
.setJournalMode(RoomDatabase.JournalMode.WRITE_AHEAD_LOGGING) | ||
.setDriver(driver) | ||
.setQueryCoroutineContext(queryCoroutineContext) | ||
.build() | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
sqlite-driver/src/linuxTest/kotlin/chasm/ChasmBasicRoomTest.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,33 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package ru.pixnews.wasm.sqlite.driver.chasm | ||
|
||
import ru.pixnews.wasm.sqlite.driver.WasmSQLiteDriver | ||
import ru.pixnews.wasm.sqlite.driver.base.LinuxDatabaseFactory | ||
import ru.pixnews.wasm.sqlite.driver.test.base.tests.room.AbstractBasicRoomTest | ||
import ru.pixnews.wasm.sqlite.test.utils.TempFolder | ||
import kotlin.test.AfterTest | ||
import kotlin.test.BeforeTest | ||
|
||
class ChasmBasicRoomTest : AbstractBasicRoomTest<WasmSQLiteDriver<*>>( | ||
driverFactory = ChasmSqliteDriverFactory, | ||
databaseFactory = LinuxDatabaseFactory(), | ||
) { | ||
private lateinit var tempDir: TempFolder | ||
|
||
@BeforeTest | ||
fun setupTempDir() { | ||
tempDir = TempFolder.create() | ||
} | ||
|
||
@AfterTest | ||
fun cleanupTempDir() { | ||
tempDir.delete() | ||
} | ||
|
||
override fun fileInTempDir(databaseName: String): String = tempDir.resolve(databaseName) | ||
} |
31 changes: 31 additions & 0 deletions
31
sqlite-driver/src/linuxTest/kotlin/chasm/ChasmIcuCollationTest.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,31 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package ru.pixnews.wasm.sqlite.driver.chasm | ||
|
||
import ru.pixnews.wasm.sqlite.driver.WasmSQLiteDriver | ||
import ru.pixnews.wasm.sqlite.driver.test.base.tests.AbstractIcuCollationTest | ||
import ru.pixnews.wasm.sqlite.test.utils.TempFolder | ||
import kotlin.test.AfterTest | ||
import kotlin.test.BeforeTest | ||
|
||
class ChasmIcuCollationTest : AbstractIcuCollationTest<WasmSQLiteDriver<*>>( | ||
driverCreator = ChasmSqliteDriverFactory, | ||
) { | ||
private lateinit var tempDir: TempFolder | ||
|
||
@BeforeTest | ||
fun setupTempDir() { | ||
tempDir = TempFolder.create() | ||
} | ||
|
||
@AfterTest | ||
fun cleanupTempDir() { | ||
tempDir.delete() | ||
} | ||
|
||
override fun fileInTempDir(databaseName: String): String = tempDir.resolve(databaseName) | ||
} |
39 changes: 39 additions & 0 deletions
39
sqlite-driver/src/linuxTest/kotlin/chasm/ChasmTimeFunctionsTest.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,39 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package ru.pixnews.wasm.sqlite.driver.chasm | ||
|
||
import ru.pixnews.wasm.sqlite.driver.WasmSQLiteDriver | ||
import ru.pixnews.wasm.sqlite.driver.test.base.tests.AbstractTimeFunctionsTest | ||
import ru.pixnews.wasm.sqlite.test.utils.TempFolder | ||
import kotlin.test.AfterTest | ||
import kotlin.test.BeforeTest | ||
import kotlin.test.Ignore | ||
import kotlin.test.Test | ||
|
||
class ChasmTimeFunctionsTest : AbstractTimeFunctionsTest<WasmSQLiteDriver<*>>( | ||
driverCreator = ChasmSqliteDriverFactory, | ||
) { | ||
private lateinit var tempDir: TempFolder | ||
|
||
@BeforeTest | ||
fun setupTempDir() { | ||
tempDir = TempFolder.create() | ||
} | ||
|
||
@AfterTest | ||
fun cleanupTempDir() { | ||
tempDir.delete() | ||
} | ||
|
||
override fun fileInTempDir(databaseName: String): String = tempDir.resolve(databaseName) | ||
|
||
@Test | ||
@Ignore // TODO | ||
override fun localtime_modifier_should_work() { | ||
super.localtime_modifier_should_work() | ||
} | ||
} |