T34: review round 3: PowerShell keeps a program's code unless the line surely ends in PowerShell, a cmdlet, a name not found or no command, so a call through a variable keeps it; bash without promptvars, zsh without prompt_percent and PowerShell without PSReadLine say at start what they cannot mark
This commit is contained in:
6 files changed
+50
-9
No files matched your search
@@ -280,6 +280,19 @@ fn zsh_reports_its_folder_byte_for_byte_and_its_titles() {
|
||||
run.finish();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zsh_says_why_it_marks_no_prompt_without_prompt_percent() {
|
||||
let mut run = Run::start(&installed("zsh"), &[(".zshrc", "unsetopt prompt_percent")]);
|
||||
run.until("the warning", |run| {
|
||||
run.shows("ELYTerminal: zsh marks no prompt while prompt_percent is off")
|
||||
});
|
||||
run.send("false");
|
||||
let ended = [Mark::Output, Mark::Done(Some(1))];
|
||||
run.until("the command's marks", |run| run.marks.ends_with(&ended));
|
||||
assert!(!run.marks.contains(&Mark::Prompt), "{:?}", run.marks);
|
||||
run.finish();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bash_reports_its_folder_byte_for_byte_and_keeps_the_status() {
|
||||
let status = r#"PROMPT_COMMAND='printf "USER_STATUS=%s\n" "$?"'; shopt -s extdebug"#;
|
||||
@@ -325,6 +338,21 @@ bind -x '"\C-t": :'"#;
|
||||
run.finish();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bash_says_why_it_marks_no_command_without_promptvars() {
|
||||
let files = [
|
||||
(".bashrc", "shopt -u promptvars"),
|
||||
(".bash_profile", "shopt -u promptvars"),
|
||||
];
|
||||
let mut run = Run::start(&installed("bash"), &files);
|
||||
run.until("the warning", |run| {
|
||||
run.shows("ELYTerminal: bash marks no command while promptvars is off")
|
||||
});
|
||||
run.walk("declare -F _ely_prompt >/dev/null && echo ELY-LOAD''ED");
|
||||
run.ends("false", &[Mark::Prompt, Mark::Input]);
|
||||
run.finish();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fish_loads_its_script_and_restores_its_data_dirs() {
|
||||
let mut run = Run::start(&installed("fish"), &[]);
|
||||
@@ -368,6 +396,10 @@ fn powershell_reports_its_folder_byte_for_byte_and_keeps_the_status() {
|
||||
&ended(1),
|
||||
);
|
||||
run.ends("Get-Item ./missing; sh -c 'exit 7'", &ended(7));
|
||||
// A call through a variable runs a program the line does not name.
|
||||
run.send("$exe = 'sh'");
|
||||
run.ends("& $exe -c 'exit 7'", &ended(7));
|
||||
run.ends("& \"$exe\" -c 'exit 9'", &ended(9));
|
||||
let native = "$PSNativeCommandUseErrorActionPreference = $true; sh -c 'exit 7'";
|
||||
run.ends(native, &ended(7));
|
||||
run.finish();
|
||||
|
||||
Reference in new issue
Block a user