Skip to content

Commit 0ffda2f

Browse files
committed
Fix compiler tests
1 parent 1016c36 commit 0ffda2f

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/IndexTests.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import io.realm.kotlin.types.RealmInstant
2828
import io.realm.kotlin.types.RealmUUID
2929
import org.junit.Test
3030
import org.mongodb.kbson.BsonObjectId
31+
import org.mongodb.kbson.Decimal128
3132
import kotlin.reflect.KClassifier
3233
import kotlin.test.assertEquals
3334
import kotlin.test.assertTrue
@@ -45,6 +46,7 @@ class IndexTests {
4546
Long::class to "1",
4647
Float::class to "1.4f",
4748
Double::class to "1.4",
49+
Decimal128::class to "BsonDecimal128(\"1.4E100\")",
4850
String::class to "\"Realm\"",
4951
RealmInstant::class to "RealmInstant.from(42, 420)",
5052
ObjectId::class to "ObjectId.create()",
@@ -80,6 +82,7 @@ class IndexTests {
8082
import io.realm.kotlin.types.annotations.Index
8183
import io.realm.kotlin.RealmConfiguration
8284
import org.mongodb.kbson.BsonObjectId
85+
import org.mongodb.kbson.BsonDecimal128
8386
8487
class A : RealmObject {
8588
@Index
@@ -99,7 +102,7 @@ class IndexTests {
99102
result.exitCode,
100103
type.toString()
101104
)
102-
assertTrue(result.messages.contains(Regex("sources/indexing.kt: \\(12, 5\\): .*but must be of type")))
105+
assertTrue(result.messages.contains(Regex("Indexed key .* is of type .* but must be of type")), result.messages)
103106
}
104107
}
105108
}
@@ -135,7 +138,7 @@ class IndexTests {
135138
)
136139
)
137140
assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, "anyType")
138-
assertTrue(result.messages.contains("Indexed key indexedKey is of type ${pair.first} but must be of type"))
141+
assertTrue(result.messages.contains("Indexed key indexedKey is of type ${pair.first} but must be of type"), result.messages)
139142
}
140143
}
141144
}

packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/PrimaryKeyTests.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import io.realm.kotlin.types.RealmInstant
2727
import io.realm.kotlin.types.RealmUUID
2828
import org.junit.Test
2929
import org.mongodb.kbson.BsonObjectId
30+
import org.mongodb.kbson.Decimal128
3031
import kotlin.reflect.KClassifier
3132
import kotlin.test.assertEquals
3233
import kotlin.test.assertTrue
@@ -46,6 +47,7 @@ class PrimaryKeyTests {
4647
Long::class to "1",
4748
Float::class to "1.4f",
4849
Double::class to "1.4",
50+
Decimal128::class to "BsonDecimal128(\"1.4E100\")",
4951
String::class to "\"Realm\"",
5052
RealmInstant::class to "RealmInstant.from(42, 420)",
5153
ObjectId::class to "ObjectId.create()",
@@ -79,6 +81,7 @@ class PrimaryKeyTests {
7981
import io.realm.kotlin.RealmConfiguration
8082
import io.realm.kotlin.types.annotations.PrimaryKey
8183
import org.mongodb.kbson.BsonObjectId
84+
import org.mongodb.kbson.BsonDecimal128
8285
8386
class A : RealmObject {
8487
@PrimaryKey

packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/list/ListTests.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ import io.realm.kotlin.types.RealmList
147147
import io.realm.kotlin.types.RealmObject
148148
import io.realm.kotlin.types.RealmUUID
149149
import org.mongodb.kbson.BsonObjectId
150+
import org.mongodb.kbson.BsonDecimal128
150151
151152
import java.lang.Exception
152153
@@ -164,6 +165,7 @@ import io.realm.kotlin.types.RealmList
164165
import io.realm.kotlin.types.RealmObject
165166
import io.realm.kotlin.types.RealmUUID
166167
import org.mongodb.kbson.BsonObjectId
168+
import org.mongodb.kbson.BsonDecimal128
167169
168170
import java.lang.Exception
169171
@@ -181,6 +183,7 @@ import io.realm.kotlin.types.RealmList
181183
import io.realm.kotlin.types.RealmObject
182184
import io.realm.kotlin.types.RealmUUID
183185
import org.mongodb.kbson.BsonObjectId
186+
import org.mongodb.kbson.BsonDecimal128
184187
185188
import java.lang.Exception
186189

packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/set/SetTests.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class SetTests {
5858
"nonNullableSet.kt",
5959
NON_NULLABLE_SET_CODE.format(nonNullableType)
6060
)
61-
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)
61+
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages)
6262
}
6363
}
6464

@@ -103,7 +103,7 @@ class SetTests {
103103
supportedPrimitiveTypes.forEach { primitiveType ->
104104
val result =
105105
createFileAndCompile("nullableTypeSet.kt", NULLABLE_TYPE_CODE.format(primitiveType))
106-
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)
106+
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages)
107107
}
108108
}
109109

@@ -151,6 +151,7 @@ import io.realm.kotlin.types.RealmObject
151151
import io.realm.kotlin.types.RealmSet
152152
import io.realm.kotlin.types.RealmUUID
153153
import org.mongodb.kbson.BsonObjectId
154+
import org.mongodb.kbson.BsonDecimal128
154155
155156
import java.lang.Exception
156157
@@ -168,6 +169,7 @@ import io.realm.kotlin.types.RealmObject
168169
import io.realm.kotlin.types.RealmSet
169170
import io.realm.kotlin.types.RealmUUID
170171
import org.mongodb.kbson.BsonObjectId
172+
import org.mongodb.kbson.BsonDecimal128
171173
172174
import java.lang.Exception
173175
@@ -185,6 +187,7 @@ import io.realm.kotlin.types.RealmObject
185187
import io.realm.kotlin.types.RealmSet
186188
import io.realm.kotlin.types.RealmUUID
187189
import org.mongodb.kbson.BsonObjectId
190+
import org.mongodb.kbson.BsonDecimal128
188191
189192
import java.lang.Exception
190193

0 commit comments

Comments
 (0)