Skip to content

Commit 4f6565e

Browse files
committed
Fix tests
1 parent 2b7753f commit 4f6565e

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/test_utils.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ impl TestCommandResult {
4141
}
4242

4343
/// Execute a sync command directly
44-
pub fn sync_command_direct(merge: bool) -> TestCommandResult {
44+
pub fn sync_command_direct(_merge: bool) -> TestCommandResult {
4545
// The sync::run function prints to stderr for errors and doesn't return a Result
4646
// We need to check the git state to determine if it would succeed
47-
47+
4848
// Try to get current branch to test if we're in a git repo
4949
if std::process::Command::new("git")
5050
.args(["rev-parse", "--is-inside-work-tree"])
@@ -54,7 +54,7 @@ pub fn sync_command_direct(merge: bool) -> TestCommandResult {
5454
{
5555
return TestCommandResult::failure("❌ Git command failed".to_string(), 1);
5656
}
57-
57+
5858
// Check if there's an upstream configured
5959
if std::process::Command::new("git")
6060
.args(["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"])
@@ -64,7 +64,7 @@ pub fn sync_command_direct(merge: bool) -> TestCommandResult {
6464
{
6565
return TestCommandResult::failure("❌ No upstream configured".to_string(), 1);
6666
}
67-
67+
6868
// If we get here, the command would likely succeed
6969
// For testing purposes, we'll simulate success
7070
TestCommandResult::success("✅ Already up to date".to_string())
@@ -81,15 +81,15 @@ pub fn large_files_command_direct(_limit: usize, threshold: Option<f64>) -> Test
8181
{
8282
return TestCommandResult::failure("❌ Git command failed".to_string(), 1);
8383
}
84-
84+
8585
// Simulate the output based on threshold
8686
if let Some(thresh) = threshold {
8787
if thresh > 50.0 {
8888
// Format with decimal to match the expected format
8989
let output = if thresh == thresh.floor() {
90-
format!("No files larger than {:.1}MB found", thresh)
90+
format!("No files larger than {thresh:.1}MB found")
9191
} else {
92-
format!("No files larger than {}MB found", thresh)
92+
format!("No files larger than {thresh}MB found")
9393
};
9494
TestCommandResult::success(output)
9595
} else {
@@ -155,4 +155,4 @@ pub fn sync_command(merge: bool) -> SyncCommand {
155155
/// Helper to create a large files command for testing
156156
pub fn large_files_command(limit: usize, threshold: Option<f64>) -> LargeFilesCommand {
157157
LargeFilesCommand { limit, threshold }
158-
}
158+
}

tests/test_large_files.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn test_large_files_run_function_outside_git_repo() {
168168
.assert()
169169
.success() // The command succeeds but shows an error message
170170
.stderr(predicate::str::contains("Failed to get file objects"));
171-
171+
172172
// Test direct function call (for coverage)
173173
match execute_command_in_dir(temp_dir.path(), large_files_command(10, None)) {
174174
Ok(result) => {
@@ -252,7 +252,7 @@ fn test_large_files_run_function_with_files() {
252252
.assert()
253253
.success()
254254
.stdout(predicate::str::contains("Scanning repository"));
255-
255+
256256
// Test direct function call (for coverage)
257257
match execute_command_in_dir(&repo_path, large_files_command(10, None)) {
258258
Ok(result) => {
@@ -283,7 +283,7 @@ fn test_large_files_with_high_threshold() {
283283
.assert()
284284
.success()
285285
.stdout(predicate::str::contains("No files found larger than"));
286-
286+
287287
// Test direct function call with high threshold (for coverage)
288288
match execute_command_in_dir(&repo_path, large_files_command(10, Some(100.0))) {
289289
Ok(result) => {

tests/test_sync.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn test_sync_run_function_outside_git_repo() {
119119
.assert()
120120
.success()
121121
.stderr(predicate::str::contains("Not in a git repository"));
122-
122+
123123
// Test direct function call (for coverage)
124124
let result = execute_command_in_dir(temp_dir.path(), sync_command(false)).unwrap();
125125
assert!(result.is_failure());
@@ -138,7 +138,7 @@ fn test_sync_run_function_no_upstream() {
138138
.assert()
139139
.success()
140140
.stderr(predicate::str::contains("No upstream branch configured"));
141-
141+
142142
// Test direct function call (for coverage)
143143
let result = execute_command_in_dir(repo.path(), sync_command(false)).unwrap();
144144
assert!(result.is_failure());
@@ -337,7 +337,7 @@ fn test_run_function_complete_flow() {
337337
.assert()
338338
.success()
339339
.stderr(predicate::str::contains("Not in a git repository"));
340-
340+
341341
// Test direct function call (for coverage)
342342
let result = execute_command_in_dir(temp_dir.path(), sync_command(false)).unwrap();
343343
assert!(result.is_failure());

0 commit comments

Comments
 (0)