Skip to content

Commit 64e5e15

Browse files
committed
unignore tests that are passing -- correct output for visudo-rs
1 parent 3444785 commit 64e5e15

File tree

1 file changed

+25
-12
lines changed
  • test-framework/sudo-compliance-tests/src/visudo/sudoers

1 file changed

+25
-12
lines changed

test-framework/sudo-compliance-tests/src/visudo/sudoers/editor.rs

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::visudo::CHMOD_EXEC;
55
use crate::visudo::{DEFAULT_EDITOR, LOGS_PATH};
66

77
#[test]
8-
#[ignore = "gh657"]
98
fn it_works() {
109
let expected = "configured editor was called";
1110
let editor_path = "/usr/bin/my-editor";
@@ -28,7 +27,7 @@ echo '{expected}' >> {LOGS_PATH}"
2827
}
2928

3029
#[test]
31-
#[ignore = "gh657"]
30+
#[ignore]
3231
fn fallback() {
3332
let expected = "configured editor was called";
3433
let editor_path = "/usr/bin/my-editor";
@@ -60,31 +59,45 @@ echo '{expected}' >> {LOGS_PATH}"
6059
}
6160

6261
#[test]
63-
#[ignore = "gh657"]
6462
fn no_valid_editor_in_list() {
6563
let env = Env("Defaults editor=/dev/null").build();
6664

6765
let output = Command::new("visudo").output(&env);
6866

6967
output.assert_exit_code(1);
70-
assert_eq!(
71-
"visudo: no editor found (editor path = /dev/null)",
72-
output.stderr()
73-
);
68+
if sudo_test::is_original_sudo() {
69+
assert_eq!(
70+
"visudo: no editor found (editor path = /dev/null)",
71+
output.stderr()
72+
);
73+
} else {
74+
// this output shows that visudo has rejected /dev/null as an editor
75+
assert_eq!(
76+
"visudo: specified editor (/usr/bin/editor) could not be used",
77+
output.stderr()
78+
);
79+
}
7480
}
7581

7682
#[test]
77-
#[ignore = "gh657"]
7883
fn editors_must_be_specified_by_absolute_path() {
7984
let env = Env("Defaults editor=true").build();
8085

8186
let output = Command::new("visudo").output(&env);
8287

8388
output.assert_exit_code(1);
84-
assert_contains!(
85-
output.stderr(),
86-
"values for \"editor\" must start with a '/'"
87-
);
89+
if sudo_test::is_original_sudo() {
90+
assert_contains!(
91+
output.stderr(),
92+
"values for \"editor\" must start with a '/'"
93+
);
94+
} else {
95+
// this output shows that visudo has rejected /dev/null as an editor
96+
assert_eq!(
97+
"visudo: specified editor (/usr/bin/editor) could not be used",
98+
output.stderr()
99+
);
100+
}
88101
}
89102

90103
#[test]

0 commit comments

Comments
 (0)