mirror of
https://github.com/imjasonh/testscript-rs
synced 2026-07-16 12:12:07 +00:00
Fix code formatting with cargo fmt
Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com>
This commit is contained in:
parent
09163e0ddf
commit
5e36f27de9
1 changed files with 28 additions and 11 deletions
|
|
@ -29,7 +29,11 @@ Test content in custom root
|
||||||
.workdir_root(custom_root_path)
|
.workdir_root(custom_root_path)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
assert!(result.is_ok(), "Test with custom workdir root failed: {:?}", result);
|
assert!(
|
||||||
|
result.is_ok(),
|
||||||
|
"Test with custom workdir root failed: {:?}",
|
||||||
|
result
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -50,15 +54,21 @@ stdout "test"
|
||||||
.workdir_root(nonexistent_path)
|
.workdir_root(nonexistent_path)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
assert!(result.is_err(), "Expected error for non-existent workdir root");
|
assert!(
|
||||||
|
result.is_err(),
|
||||||
|
"Expected error for non-existent workdir root"
|
||||||
|
);
|
||||||
let error_msg = format!("{:?}", result.unwrap_err());
|
let error_msg = format!("{:?}", result.unwrap_err());
|
||||||
assert!(error_msg.contains("does not exist"), "Error should mention directory doesn't exist");
|
assert!(
|
||||||
|
error_msg.contains("does not exist"),
|
||||||
|
"Error should mention directory doesn't exist"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_workdir_root_not_a_directory() {
|
fn test_workdir_root_not_a_directory() {
|
||||||
let temp_dir = TempDir::new().unwrap();
|
let temp_dir = TempDir::new().unwrap();
|
||||||
|
|
||||||
// Create a file (not directory) to test the validation
|
// Create a file (not directory) to test the validation
|
||||||
let file_path = temp_dir.path().join("not_a_directory.txt");
|
let file_path = temp_dir.path().join("not_a_directory.txt");
|
||||||
fs::write(&file_path, "this is a file").unwrap();
|
fs::write(&file_path, "this is a file").unwrap();
|
||||||
|
|
@ -78,12 +88,17 @@ stdout "test"
|
||||||
.workdir_root(&file_path)
|
.workdir_root(&file_path)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
assert!(result.is_err(), "Expected error for file used as workdir root");
|
assert!(
|
||||||
|
result.is_err(),
|
||||||
|
"Expected error for file used as workdir root"
|
||||||
|
);
|
||||||
let error_msg = format!("{:?}", result.unwrap_err());
|
let error_msg = format!("{:?}", result.unwrap_err());
|
||||||
assert!(error_msg.contains("not a directory"), "Error should mention path is not a directory");
|
assert!(
|
||||||
|
error_msg.contains("not a directory"),
|
||||||
|
"Error should mention path is not a directory"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_workdir_root_with_preserve_work() {
|
fn test_workdir_root_with_preserve_work() {
|
||||||
// Create a temporary directory to use as our custom root
|
// Create a temporary directory to use as our custom root
|
||||||
|
|
@ -110,11 +125,13 @@ Configuration file for testing
|
||||||
.preserve_work_on_failure(true)
|
.preserve_work_on_failure(true)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
assert!(result.is_ok(), "Combined features test failed: {:?}", result);
|
assert!(
|
||||||
|
result.is_ok(),
|
||||||
|
"Combined features test failed: {:?}",
|
||||||
|
result
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_workdir_root_api_chaining() {
|
fn test_workdir_root_api_chaining() {
|
||||||
// Test that the API method exists and can be chained
|
// Test that the API method exists and can be chained
|
||||||
|
|
@ -136,4 +153,4 @@ stdout "chaining test"
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
assert!(result.is_ok(), "API chaining test failed: {:?}", result);
|
assert!(result.is_ok(), "API chaining test failed: {:?}", result);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue