-
Notifications
You must be signed in to change notification settings - Fork 34
pmap: implemented rc options #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
2ab7371
6218de1
0502bf6
1d6c087
dce5a9e
91c4937
2e0ebf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,74 @@ fn test_no_args() { | |
| new_ucmd!().fails().code_is(1); | ||
| } | ||
|
|
||
| #[test] | ||
| #[cfg(target_os = "linux")] | ||
| fn test_default_rc() { | ||
| let pid = process::id(); | ||
| let ts = TestScenario::new(util_name!()); | ||
|
|
||
| // Fails to read before creating rc file | ||
| for arg in ["-c", "--read-rc"] { | ||
| ts.ucmd().arg(arg).arg(pid.to_string()).fails().code_is(1); | ||
| } | ||
|
|
||
| // Create rc file | ||
| ts.ucmd().arg("-n").succeeds(); | ||
|
|
||
| // Fails to create because rc file already exists | ||
| for arg in ["-n", "--create-rc"] { | ||
| ts.ucmd().arg(arg).fails().code_is(1); | ||
| } | ||
|
|
||
| // Succeeds to read now | ||
| for arg in ["-c", "--read-rc"] { | ||
| ts.ucmd().arg(arg).arg(pid.to_string()).succeeds(); | ||
| } | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can run the functionality of this test in the CI only, otherwise the test will fail if there is already a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you both! |
||
|
|
||
| #[test] | ||
| #[cfg(target_os = "linux")] | ||
| fn test_create_rc_to() { | ||
| let ts = TestScenario::new(util_name!()); | ||
|
|
||
| ts.ucmd().args(&["-N", "pmap_rc_file_name"]).succeeds(); | ||
|
|
||
| // Fails to create because rc file already exists | ||
| for arg in ["-N", "--create-rc-to"] { | ||
| ts.ucmd() | ||
| .args(&[arg, "pmap_rc_file_name"]) | ||
| .fails() | ||
| .code_is(1); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| #[cfg(target_os = "linux")] | ||
| fn test_read_rc_from() { | ||
| let pid = process::id(); | ||
| let ts = TestScenario::new(util_name!()); | ||
|
|
||
| // Fails to read before creating rc file | ||
| for arg in ["-C", "--read-rc-from"] { | ||
| ts.ucmd() | ||
| .args(&[arg, "pmap_rc_file_name"]) | ||
| .arg(pid.to_string()) | ||
| .fails() | ||
| .code_is(1); | ||
| } | ||
|
|
||
| // Create rc file | ||
| ts.ucmd().args(&["-N", "pmap_rc_file_name"]).succeeds(); | ||
|
|
||
| // Succeeds to read now | ||
| for arg in ["-C", "--read-rc-from"] { | ||
| ts.ucmd() | ||
| .args(&[arg, "pmap_rc_file_name"]) | ||
| .arg(pid.to_string()) | ||
| .succeeds(); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| #[cfg(target_os = "linux")] | ||
| fn test_existing_pid() { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.