Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
RDPerera committed Mar 8, 2024
1 parent b79b633 commit 3f70316
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "ballerina/tests/resources"]
path = ballerina/tests/resources
url = https://github.com/nipunayf/toml-test
branch = resources
25 changes: 6 additions & 19 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,29 +104,16 @@ publishing {
}
}

task cloneTestRepo {
task checkAndUpdateSubmodule {
doLast {
def testResourcesDir = new File("${project.projectDir}/tests/resources")
if (!testResourcesDir.exists()) {
testResourcesDir.mkdirs()
}
exec {
workingDir testResourcesDir.parentFile
commandLine 'git', 'clone', 'https://github.com/nipunayf/toml-test.git', testResourcesDir.name, '-b', 'resources'
}
def submoduleDir = new File(projectDir, '/tests/resources')
def initCommand = ['git', 'submodule', 'update', '--init', '--recursive']
initCommand.execute(null, projectDir).waitFor()
println "Submodule initialized successfully."
}
}

task cleanupTestRepo {
doLast {
def testResourcesDir = new File("${project.projectDir}/tests/resources")
testResourcesDir.deleteDir()
}
}

test.finalizedBy cleanupTestRepo
test.dependsOn cloneTestRepo

test.dependsOn checkAndUpdateSubmodule
updateTomlFiles.dependsOn copyStdlibs

build.dependsOn "generatePomFileForMavenPublication"
Expand Down
4 changes: 2 additions & 2 deletions ballerina/tests/it.bal
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
import ballerina/test;

@test:Config {
dataProvider: validTomlDataGen,
dataProvider: validTomlDataGen
}
function testValidTOML(string inputPath, json expectedOutput) returns error? {
map<json> output = check readFile(inputPath, {parseOffsetDateTime: false});
test:assertEquals(output, expectedOutput);
}

@test:Config {
dataProvider: invalidTomlDataGen,
dataProvider: invalidTomlDataGen
}
function testInvalidTOML(string inputPath) {
map<json>|error output = readFile(inputPath);
Expand Down
1 change: 1 addition & 0 deletions ballerina/tests/resources
Submodule resources added at eae1eb

0 comments on commit 3f70316

Please sign in to comment.