Skip to content

Commit

Permalink
Merge pull request #41614 from gayaldassanayake/fix-cli-testcmd-test
Browse files Browse the repository at this point in the history
Make TestCommandTest version agnostic
  • Loading branch information
gayaldassanayake authored Nov 1, 2023
2 parents 8eed597 + b20eaf9 commit f0bd69a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.ballerinalang.util.RepoUtils;
import picocli.CommandLine;

import java.io.File;
Expand Down Expand Up @@ -277,8 +278,9 @@ public void testBalTestWithStickyFlag() throws IOException {
String buildLog = readOutput(true);
Assert.assertEquals(buildLog.replaceAll("\r", ""), getOutput("bal-test-project.txt"));
Assert.assertTrue(projectPath.resolve(DEPENDENCIES_TOML).toFile().exists());
Assert.assertEquals(readFileAsString(projectPath.resolve(DEPENDENCIES_TOML)).trim(), readFileAsString(
projectPath.resolve(RESOURCE_DIR_NAME).resolve("expectedDeps.toml")).trim());
Assert.assertEquals(readFileAsString(projectPath.resolve(DEPENDENCIES_TOML)).trim(),
readFileAsString(projectPath.resolve(RESOURCE_DIR_NAME).resolve("expectedDeps.toml"))
.trim().replace("INSERT_VERSION_HERE", RepoUtils.getBallerinaShortVersion()));

// remove build file
Files.deleteIfExists(projectPath.resolve(TARGET_DIR_NAME).resolve(BUILD_FILE));
Expand All @@ -294,8 +296,9 @@ public void testBalTestWithStickyFlag() throws IOException {
String secondBuildLog = readOutput(true);
Assert.assertEquals(secondBuildLog.replaceAll("\r", ""), getOutput("bal-test-project.txt"));
Assert.assertTrue(projectPath.resolve(DEPENDENCIES_TOML).toFile().exists());
Assert.assertEquals(readFileAsString(projectPath.resolve(DEPENDENCIES_TOML)).trim(), readFileAsString(
projectPath.resolve(RESOURCE_DIR_NAME).resolve("expectedDeps.toml")).trim());
Assert.assertEquals(readFileAsString(projectPath.resolve(DEPENDENCIES_TOML)).trim(),
readFileAsString(projectPath.resolve(RESOURCE_DIR_NAME).resolve("expectedDeps.toml"))
.trim().replace("INSERT_VERSION_HERE", RepoUtils.getBallerinaShortVersion()));
}

@Test(description = "Test a ballerina project with the flag dump-graph")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.8.0-SNAPSHOT"
distribution-version = "INSERT_VERSION_HERE"

[[package]]
org = "ballerina"
Expand Down

0 comments on commit f0bd69a

Please sign in to comment.