Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7dc6105
Add schema-test-suite repository as submodule
OptimumCode Jul 25, 2023
c283dee
Move schema test suites
OptimumCode Jul 26, 2023
616e33f
Implement test suites base. Add test suite for draft7
OptimumCode Jul 26, 2023
62370a0
Init submodules
OptimumCode Jul 26, 2023
646a59b
Correct the equailty check for numbers
OptimumCode Jul 26, 2023
9dbc2a7
Correct enum assertion to correctly work with numbers
OptimumCode Jul 26, 2023
2613504
Correct type to correctly treat numbers with zero fraction part as in…
OptimumCode Jul 26, 2023
09d449d
Handle engineering number format
OptimumCode Jul 26, 2023
27fcd20
Treat numbers with zero fraction as valid integers
OptimumCode Jul 26, 2023
6a9107a
Correct unique items assertion to correctly work with numbers
OptimumCode Jul 26, 2023
c6b2ce3
Correct multipleOf assertion to work with small numbers
OptimumCode Jul 26, 2023
a91d079
Correct number comparison
OptimumCode Jul 26, 2023
26d43d4
Reformat code. Correct detekt errors
OptimumCode Jul 26, 2023
dd1d149
Fix incorrect precision computation
OptimumCode Jul 26, 2023
ff1ce0a
Use linked maps to keep reproducable order
OptimumCode Jul 27, 2023
e62c586
Exclude unsupported functionality from test-suites
OptimumCode Jul 27, 2023
640f122
Add proper support for unicode characters
OptimumCode Jul 27, 2023
9fa6d4d
Load all if-then-else assertions because they might be referenced
OptimumCode Jul 27, 2023
e501479
Correct work with empty path segment in JSON pointer
OptimumCode Jul 27, 2023
f5174a6
Add quotation for special characters when adding segment to pointer
OptimumCode Jul 27, 2023
2fc0a7b
Correct uri resolution
OptimumCode Jul 28, 2023
a8ab2e6
Add resolution for test suites for nodejs test run
OptimumCode Jul 28, 2023
8b2156c
Remove todo comment. Create an issue for that instead
OptimumCode Jul 28, 2023
b667649
Correct test name to correctly work on windows
OptimumCode Jul 28, 2023
a663df4
Correct formatting
OptimumCode Jul 28, 2023
ea6828a
Use chars instead of string for quotation
OptimumCode Jul 28, 2023
7036f8a
Add note about test suite compliance
OptimumCode Jul 28, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add resolution for test suites for nodejs test run
  • Loading branch information
OptimumCode committed Jul 28, 2023
commit a8ab2e6d03b1025dcbfa3de1a2b9cbf79a0f2031
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ internal fun FunSpec.runTestSuites(
excludeTests: Map<String, Set<String>> = emptyMap(),
) {
require(draftName.isNotBlank()) { "draftName is blank" }
val testSuiteDir = TEST_SUITES_DIR / draftName
val fs = fileSystem()
val testSuiteDir = when {
fs.exists(TEST_SUITES_DIR) -> TEST_SUITES_DIR
fs.exists(TEST_SUITES_DIR_FROM_ROOT) -> TEST_SUITES_DIR_FROM_ROOT
else -> fs.resolveRoot() ?: error("neither $TEST_SUITES_DIR or $TEST_SUITES_DIR_FROM_ROOT exist")
}.resolve(draftName)

require(fs.exists(testSuiteDir)) { "folder $testSuiteDir does not exist" }

executeFromDirectory(fs, testSuiteDir, excludeSuites, excludeTests)
Expand Down Expand Up @@ -120,5 +125,18 @@ private class SchemaTest(
)

private val TEST_SUITES_DIR: Path = "schema-test-suite/tests".toPath()
private val TEST_SUITES_DIR_FROM_ROOT: Path = "test-suites".toPath() / TEST_SUITES_DIR

/**
* This function tries to find the repo root using `build` folder as maker.
*
* This is done in order to execute NodeJS tests
*/
private fun FileSystem.resolveRoot(): Path? {
val absolutePath = canonicalize(".".toPath())
return generateSequence(absolutePath) {
it.parent
}.find { it.name == "build" }?.parent?.resolve(TEST_SUITES_DIR_FROM_ROOT)
}

expect fun fileSystem(): FileSystem