mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
e96b6e157c
Tests are now executed in a test-specific temporary directory, so test output on failure should be reproducible/reusable as-is without needing to have TMPDIR defined (as it only exists by default under macOS).
57 lines
2 KiB
Fish
57 lines
2 KiB
Fish
#RUN: %fish -C 'set -g fish %fish' %s
|
|
#REQUIRES: command -v tmux
|
|
|
|
# Resolve absolute path to fish (if needed) before changing directories
|
|
set fish (builtin realpath $fish)
|
|
|
|
# Isolated tmux. tmux can't handle session sockets in paths that are too long, and macOS has a very
|
|
# long $TMPDIR, so use a relative path - except macOS doesn't have `realpath --relative-to`...
|
|
# We are cd'd into a unique temp dir created/assigned by the test driver, so this will work so long
|
|
# as `tmux` is only invoked from the same PWD.
|
|
set tmpdir (command mktemp -d ./tmp.XXXXXXXX)
|
|
cd $tmpdir
|
|
set -g tmux tmux -S ./.tmux-socket -f /dev/null
|
|
|
|
set -g sleep sleep .1
|
|
set -q CI && set sleep sleep 1
|
|
|
|
|
|
$tmux new-session -x 80 -y 10 -d $fish -C '
|
|
# This is similar to "tests/interactive.config".
|
|
function fish_greeting; end
|
|
function fish_prompt; printf "prompt $status_generation> "; end
|
|
# No autosuggestion from older history.
|
|
set fish_history ""
|
|
'
|
|
# Set the correct permissions for the newly created socket to allow future connections.
|
|
# This is required at least under WSL or else each invocation will return a permissions error.
|
|
chmod 777 .tmux-socket
|
|
$sleep # Let fish draw a prompt.
|
|
|
|
# Don't escape existing token (#7526).
|
|
echo >file-1
|
|
echo >file-2
|
|
$tmux send-keys 'HOME=$PWD ls ~/' Tab
|
|
$sleep
|
|
$tmux capture-pane -p
|
|
# Note the contents may or may not have the autosuggestion appended - it is a race.
|
|
# CHECK: prompt 0> HOME=$PWD ls ~/file-{{1?}}
|
|
# CHECK: ~/file-1 ~/file-2
|
|
|
|
# No pager on single smartcase completion (#7738).
|
|
$tmux send-keys C-u C-l 'mkdir cmake CMakeFiles' Enter C-l \
|
|
'cat cmake' Tab
|
|
$sleep
|
|
$tmux capture-pane -p
|
|
# CHECK: prompt 1> cat cmake/
|
|
|
|
# Correct case in pager when prefixes differ in case (#7743).
|
|
$tmux send-keys C-u C-l 'complete -c foo2 -a "aabc aaBd" -f' Enter C-l \
|
|
'foo2 A' Tab
|
|
$sleep
|
|
$tmux capture-pane -p
|
|
# The "bc" part is the autosuggestion - we could use "tmux capture-pane -e" to check colors.
|
|
# CHECK: prompt 2> foo2 aabc
|
|
# CHECK: aabc aaBd
|
|
|
|
$tmux kill-server
|