-
Notifications
You must be signed in to change notification settings - Fork 496
/
PostgreSqlFixturesTest.kt
38 lines (33 loc) · 1.22 KB
/
PostgreSqlFixturesTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package app.cash.sqldelight.dialects.postgres
import app.cash.sqldelight.dialects.postgresql.PostgreSqlDialect
import com.alecstrong.sql.psi.test.fixtures.FixturesTest
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import org.junit.runners.Parameterized.Parameters
import java.io.File
@RunWith(Parameterized::class)
class PostgreSqlFixturesTest(name: String, fixtureRoot: File) : FixturesTest(name, fixtureRoot) {
override val replaceRules = arrayOf(
"INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT" to "SERIAL NOT NULL PRIMARY KEY",
"AUTOINCREMENT" to "",
"?1" to "?",
"?2" to "?",
"BLOB" to "TEXT",
"id TEXT GENERATED ALWAYS AS (2) UNIQUE NOT NULL" to "id TEXT GENERATED ALWAYS AS (2) STORED UNIQUE NOT NULL",
)
override fun setupDialect() {
PostgreSqlDialect().setup()
}
companion object {
private val fixtures = arrayOf("src/test/fixtures_postgresql")
@Suppress("unused")
// Used by Parameterized JUnit runner reflectively.
@Parameters(name = "{0}")
@JvmStatic
fun parameters() = fixtures.flatMap { fixtureFolder ->
File(fixtureFolder).listFiles()!!
.filter { it.isDirectory }
.map { arrayOf(it.name, it) }
} + ansiFixtures
}
}