Skip to content

Commit a816c06

Browse files
authored
fix: account for case-sensitive filesystems in java-shell tests (#375)
Some tests, e.g. those that refer to BSON types, don’t have their test resource files starting with a lowercase letter. Change the test code to accept either variant.
1 parent 4d78d80 commit a816c06

File tree

1 file changed

+6
-1
lines changed
  • packages/java-shell/src/test/kotlin/com/mongodb/mongosh

1 file changed

+6
-1
lines changed

packages/java-shell/src/test/kotlin/com/mongodb/mongosh/util.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ fun getTestNames(testDataPath: String): List<String> {
3434
}
3535

3636
fun doTest(testName: String, shell: MongoShell, testDataPath: String, db: String? = null) {
37-
val name = testName[0].toLowerCase() + testName.substring(1)
37+
// Some tests start with a lowercase variant of testName, some don't
38+
// (e.g. for BSON types like ISODate, we don't use iSODate.).
39+
var name = testName[0].toLowerCase() + testName.substring(1)
40+
if (!File("$testDataPath/$name.js").exists() && !File("$testDataPath/$name-ignored.js").exists()) {
41+
name = testName
42+
}
3843
assumeFalse(File("$testDataPath/$name-ignored.js").exists())
3944
val test: String = File("$testDataPath/$name.js").readText()
4045
var before: String? = null

0 commit comments

Comments
 (0)