mirror of
https://github.com/imjasonh/testscript-rs
synced 2026-07-19 07:06:46 +00:00
Add symlink command documentation and comprehensive error testing
Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com>
This commit is contained in:
parent
bf04701605
commit
e067bb400f
2 changed files with 17 additions and 0 deletions
|
|
@ -127,6 +127,7 @@ Test scripts use the [`txtar`](https://pkg.go.dev/github.com/rogpeppe/go-interna
|
||||||
- **mv** - Move/rename files
|
- **mv** - Move/rename files
|
||||||
- **rm** - Remove files/directories
|
- **rm** - Remove files/directories
|
||||||
- **chmod** - Change file permissions
|
- **chmod** - Change file permissions
|
||||||
|
- **symlink** - Create symbolic links
|
||||||
- **env** - Set environment variables
|
- **env** - Set environment variables
|
||||||
- **cmpenv** - Compare files with environment variable substitution
|
- **cmpenv** - Compare files with environment variable substitution
|
||||||
- **stdin** - Set stdin for next command
|
- **stdin** - Set stdin for next command
|
||||||
|
|
|
||||||
|
|
@ -206,3 +206,19 @@ original content"#;
|
||||||
let result = run_test(&script_path);
|
let result = run_test(&script_path);
|
||||||
assert!(result.is_ok(), "Symlink test failed: {:?}", result);
|
assert!(result.is_ok(), "Symlink test failed: {:?}", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_symlink_error_cases() {
|
||||||
|
let temp_dir = TempDir::new().unwrap();
|
||||||
|
let script_path = temp_dir.path().join("symlink_error_test.txt");
|
||||||
|
|
||||||
|
let script_content = r#"# Test symlink error cases
|
||||||
|
! symlink
|
||||||
|
! symlink only_one_arg
|
||||||
|
! symlink too many arguments here"#;
|
||||||
|
|
||||||
|
fs::write(&script_path, script_content).unwrap();
|
||||||
|
|
||||||
|
let result = run_test(&script_path);
|
||||||
|
assert!(result.is_ok(), "Symlink error test failed: {:?}", result);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue