-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
37 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
pub const SUCCESS_WITHOUT_CONFLICTS: i32 = 0; | ||
pub const SUCCESS_WITH_CONFLICTS: i32 = 1; | ||
|
||
pub const READING_FILE_ERROR: i32 = 129; | ||
pub const GUESS_LANGUAGE_ERROR: i32 = 130; | ||
pub const WRITING_FILE_ERROR: i32 = 131; | ||
pub const INTERNAL_EXECUTION_ERROR: i32 = 132; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
mod cli_exit_codes; | ||
mod control; | ||
|
||
pub use cli_exit_codes::*; | ||
pub use control::run_tool_on_merge_scenario; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,25 @@ | ||
// use std::process::Command; | ||
|
||
// use assert_cmd::prelude::*; | ||
|
||
// #[test] | ||
// fn it_does_not_crash_and_produces_the_expected_output() { | ||
// let mut cmd = Command::cargo_bin("generic-merge").unwrap(); | ||
// cmd.arg("--base-path=tests/samples/smoke_java/base.java") | ||
// .arg("--left-path=tests/samples/smoke_java/left.java") | ||
// .arg("--right-path=tests/samples/smoke_java/right.java") | ||
// .arg("--merge-path=tests/samples/smoke_java/merge.output.java") | ||
// .assert() | ||
// .code(0); | ||
|
||
// assert_eq!( | ||
// std::fs::read_to_string("tests/samples/smoke_java/merge.expected.java").unwrap(), | ||
// std::fs::read_to_string("tests/samples/smoke_java/merge.output.java").unwrap() | ||
// ) | ||
// } | ||
|
||
// #[test] | ||
// fn if_left_equals_base_then_output_right_as_result() { | ||
// let mut cmd = Command::cargo_bin("generic-merge").unwrap(); | ||
// cmd.arg("--base-path=tests/samples/one_parent_equals_base/base.java") | ||
// .arg("--left-path=tests/samples/one_parent_equals_base/base.java") | ||
// .arg("--right-path=tests/samples/one_parent_equals_base/changed_parent.java") | ||
// .arg("--merge-path=tests/samples/one_parent_equals_base/merge.output.right.java") | ||
// .assert() | ||
// .code(0); | ||
|
||
// assert_eq!( | ||
// std::fs::read_to_string("tests/samples/one_parent_equals_base/changed_parent.java") | ||
// .unwrap(), | ||
// std::fs::read_to_string("tests/samples/one_parent_equals_base/merge.output.right.java") | ||
// .unwrap() | ||
// ) | ||
// } | ||
|
||
// #[test] | ||
// fn if_right_equals_base_then_output_left_as_result() { | ||
// let mut cmd = Command::cargo_bin("generic-merge").unwrap(); | ||
// cmd.arg("--base-path=tests/samples/one_parent_equals_base/base.java") | ||
// .arg("--left-path=tests/samples/one_parent_equals_base/base.java") | ||
// .arg("--right-path=tests/samples/one_parent_equals_base/changed_parent.java") | ||
// .arg("--merge-path=tests/samples/one_parent_equals_base/merge.output.left.java") | ||
// .assert() | ||
// .code(0); | ||
|
||
// assert_eq!( | ||
// std::fs::read_to_string("tests/samples/one_parent_equals_base/changed_parent.java") | ||
// .unwrap(), | ||
// std::fs::read_to_string("tests/samples/one_parent_equals_base/merge.output.left.java") | ||
// .unwrap() | ||
// ) | ||
// } | ||
|
||
// #[test] | ||
// fn it_works_on_semi_structured_merge() { | ||
// run_tool_on_scenario("semi_structured") | ||
// } | ||
|
||
// #[test] | ||
// fn it_works_on_node_reordering() { | ||
// run_tool_on_scenario("node_reordering") | ||
// } | ||
|
||
// #[test] | ||
// fn it_works_on_no_conflicts() { | ||
// run_tool_on_scenario("no_conflicts") | ||
// } | ||
|
||
// fn run_tool_on_scenario(scenario_name: &str) { | ||
// let mut cmd = Command::cargo_bin("generic-merge").unwrap(); | ||
// cmd.arg(format!("-b=tests/samples/{}/base.java", scenario_name)) | ||
// .arg(format!("-l=tests/samples/{}/left.java", scenario_name)) | ||
// .arg(format!("-r=tests/samples/{}/right.java", scenario_name)) | ||
// .arg(format!( | ||
// "-m=tests/samples/{}/merge.output.java", | ||
// scenario_name | ||
// )) | ||
// .assert() | ||
// .code(0); | ||
|
||
// let expected_result_path = format!("tests/samples/{}/merge.expected.java", scenario_name); | ||
// let actual_result_path = format!("tests/samples/{}/merge.output.java", scenario_name); | ||
|
||
// assert_eq!( | ||
// std::fs::read_to_string(expected_result_path).unwrap(), | ||
// std::fs::read_to_string(actual_result_path).unwrap() | ||
// ) | ||
// } | ||
use std::process::Command; | ||
|
||
use assert_cmd::prelude::*; | ||
|
||
#[test] | ||
fn if_there_is_a_conflict_it_returns_valid_exit_code() { | ||
let mut cmd = Command::cargo_bin("generic-merge").unwrap(); | ||
cmd.arg("--base-path=tests/samples/smoke_java/base.java") | ||
.arg("--left-path=tests/samples/smoke_java/left.java") | ||
.arg("--right-path=tests/samples/smoke_java/right.java") | ||
.arg("--merge-path=tests/samples/smoke_java/merge.java") | ||
.assert() | ||
.code(bin::SUCCESS_WITH_CONFLICTS); | ||
} | ||
|
||
#[test] | ||
fn if_there_is_no_conflict_it_returns_valid_exit_code() { | ||
let mut cmd = Command::cargo_bin("generic-merge").unwrap(); | ||
cmd.arg("--base-path=tests/samples/no_conflicts/base.java") | ||
.arg("--left-path=tests/samples/no_conflicts/left.java") | ||
.arg("--right-path=tests/samples/no_conflicts/right.java") | ||
.arg("--merge-path=tests/samples/no_conflicts/merge.java") | ||
.assert() | ||
.code(bin::SUCCESS_WITHOUT_CONFLICTS); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#[derive(Clone, Copy)] | ||
#[derive(Clone, Copy, Eq, PartialEq, Debug)] | ||
pub enum Language { | ||
Java, | ||
} |