Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintegrate Community-Driven Test Suites #38

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

@NipunaRanasinghe NipunaRanasinghe Mar 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to use the fork instead of the original repo (https://github.com/toml-lang/toml-test) for the submodule? @nipunayf any idea?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately, this decision is made to have control over the test suite. If there are new test cases that have breaking changes to the supported specification, then the lang library would fail. Ideally, in such cases, we should handle it in a different major version rather than allowing the build to fail. More importantly, some cases were modified or removed intentionally due to a few limitations in the Ballerina language, since the modules were designed to be pure Ballerina.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack. That makes sense.

branch = resources
2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerina"
name = "toml"
version = "0.5.0"
version = "0.5.1"
authors = ["Ballerina"]
keywords = ["toml"]
repository = "https://github.com/ballerina-platform/module-ballerina-toml"
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ modules = [
[[package]]
org = "ballerina"
name = "toml"
version = "0.5.0"
version = "0.5.1"
dependencies = [
{org = "ballerina", name = "file"},
{org = "ballerina", name = "io"},
Expand Down
9 changes: 9 additions & 0 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ publishing {
}
}

task checkAndUpdateSubmodule {
doLast {
def initCommand = ['git', 'submodule', 'update', '--init', '--recursive']
initCommand.execute(null, projectDir).waitFor()
println "Submodule initialized successfully."
}
}

test.dependsOn checkAndUpdateSubmodule
updateTomlFiles.dependsOn copyStdlibs

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

@test:Config {
dataProvider: validTomlDataGen,
enable: false
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,
enable: false
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
Loading