summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-07-10 23:52:33 +0000
committerbrian m. carlson <sandals@crustytoothpaste.net>2020-07-10 23:52:33 +0000
commit3609ad2a20dbc297c52879fc9c1f7ba3dfbe0ff4 (patch)
tree0c5ad37b8090fe99c28506bbca4b0e6d995f6805
parent5dd6b359b6b32ddbb59496b9c5265b8c10a7054b (diff)
spec: ensure zsh doesn't print escape characters on dumb terminals
When we're on a dumb terminal, zsh should not use colors or other escapes sequences, since the terminal does not support them. Add a test to ensure that's the case. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
-rw-r--r--spec/zsh_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/zsh_spec.rb b/spec/zsh_spec.rb
index 2cbf525..0ddd75d 100644
--- a/spec/zsh_spec.rb
+++ b/spec/zsh_spec.rb
@@ -52,4 +52,11 @@ describe :zsh do
expect(@dir.cmd(['zsh', '-c', 'echo $VISUAL'])).to eq "ex\n"
end
end
+
+ context 'prompt' do
+ it 'should not print escape characters with a dumb terminal' do
+ expect(@dir.cmd(['zsh', '-c', 'source .zshrc; echo $PS1'])).not_to match(/\x1b/)
+ expect(@dir.cmd(['zsh', '-c', 'source .zshrc; echo $PS1'], 'TERM' => 'dumb')).not_to match(/\x1b/)
+ end
+ end
end