()
| 4169 | /// Test merge feature: simple mode flag |
| 4170 | #[test] |
| 4171 | fn merge_subcommand_simple_mode() { |
| 4172 | println!("=== TEST SETUP: MERGE SUBCOMMAND SIMPLE MODE ==="); |
| 4173 | let repo_name = "merge_simple_mode"; |
| 4174 | let repo = setup_git_repo(repo_name); |
| 4175 | let path_to_repo = generate_path_to_repo(repo_name); |
| 4176 | |
| 4177 | // Helper function to get git log for a specific branch |
| 4178 | fn get_git_log(path_to_repo: &Path, branch_name: &str, num_entries: &str) -> String { |
| 4179 | let output = run_git_command( |
| 4180 | path_to_repo, |
| 4181 | vec!["log", "--oneline", "-n", num_entries, branch_name], |
| 4182 | ); |
| 4183 | String::from_utf8_lossy(&output.stdout).to_string() |
| 4184 | } |
| 4185 | |
| 4186 | println!("=== REPOSITORY INITIALIZATION ==="); |
| 4187 | // Create initial repository |
| 4188 | { |
| 4189 | create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!"); |
| 4190 | first_commit_all(&repo, "first commit"); |
| 4191 | |
| 4192 | // Create branches for chain |
| 4193 | create_branch(&repo, "feature_1"); |
| 4194 | checkout_branch(&repo, "feature_1"); |
| 4195 | create_new_file(&path_to_repo, "feature1.txt", "Feature 1 content"); |
| 4196 | commit_all(&repo, "feature 1 commit"); |
| 4197 | |
| 4198 | create_branch(&repo, "feature_2"); |
| 4199 | checkout_branch(&repo, "feature_2"); |
| 4200 | create_new_file(&path_to_repo, "feature2.txt", "Feature 2 content"); |
| 4201 | commit_all(&repo, "feature 2 commit"); |
| 4202 | |
| 4203 | println!("=== SETTING UP CHAIN ==="); |
| 4204 | // Setup the chain |
| 4205 | let args: Vec<&str> = vec!["setup", "feature_chain", "master", "feature_1", "feature_2"]; |
| 4206 | let output = run_test_bin_expect_ok(&path_to_repo, args); |
| 4207 | |
| 4208 | let stdout = String::from_utf8_lossy(&output.stdout); |
| 4209 | let success_setup = stdout.contains("Succesfully set up chain: feature_chain"); |
| 4210 | |
| 4211 | println!("Chain setup output: {}", stdout); |
| 4212 | println!("Chain setup success: {}", success_setup); |
| 4213 | |
| 4214 | assert!( |
| 4215 | success_setup, |
| 4216 | "stdout should confirm chain setup but got: {}", |
| 4217 | stdout |
| 4218 | ); |
| 4219 | } |
| 4220 | |
| 4221 | println!("=== MASTER BRANCH UPDATE ==="); |
| 4222 | // Update master |
| 4223 | checkout_branch(&repo, "master"); |
| 4224 | create_new_file(&path_to_repo, "master_update.txt", "Master update"); |
| 4225 | commit_all(&repo, "Update master"); |
| 4226 | |
| 4227 | // Verify master has the update |
| 4228 | let master_log = get_git_log(&path_to_repo, "master", "5"); |
nothing calls this directly
no test coverage detected