fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
598e98794
master
1#RUN: %fish %s 2 3#REQUIRES: command -v tmux 4#REQUIRES: command -v wget 5#REQUIRES: command -v diff 6 7isolated-tmux-start 8 9# Widen the window because URLs can be fairly long and we do not want to deal 10# with wrapping. 11# We would prefer to redirect fish_config's output to a file instead and avoid 12# the issue altogether, but we need to extract the auth string and unfortunately, 13# because of buffering, the file will remain empty until the buffer is full or 14# fish_config exits. 15isolated-tmux resize-window -x500 16 17isolated-tmux send-keys"BROWSER=true fish_config" Enter 18sleep-until 'isolated-tmux capture-pane -p | grep ENTER' 19isolated-tmux capture-pane -p 20# CHECK: prompt 0> BROWSER=true fish_config 21# CHECK: Web config started at file://{{.*}}.html 22# CHECK: If that doesn't work, try opening http://localhost:{{(\d{4})}}/{{\w+}}/ 23# CHECK: Hit ENTER to stop. 24 25# Extract the URL from the output 26set -l base_url( isolated-tmux capture-pane -p| string match -r'http://localhost:\d{4}/\w+/$' ) 27or exit 28set -l host_port( dirname $base_url ) 29 30# Check a bad URL (http://host:port/invalid_auth/) 31wget -q -O /dev/null$host_port /invalid_auth/2> /dev/null 32set -l last_status$status 33# Busybox's wget does not return the same code as GNU's. Currently this affects 34# the Alpine CI. If the Alpine image is update to GNU wget, we should be able to 35# safely assume everybody uses GNU's (until we told otherwise) 36switch "$ ( wget --version 2>&1 ) " 37case '*GNU*' 38test $last_status -eq 8 39case '*busybox*' 40test $last_status -eq 1 41case '*' 42# Only rely on the fish_config logs, which is the critical test. 43# The status code is only a "nice to have" 44true 45end 46or echo "Unexpected exit code ( $last_status ) from wget" 47 48isolated-tmux capture-pane -p -S4 49# CHECK: {{.*}} code 403, message Forbidden, path /invalid_auth/ 50 51# Check a good URL 52set -l workspace_root( path resolve --( status dirname) /../../) 53diff -q" $workspace_root /share/tools/web_config/index.html" ( wget -q -O -$base_url 2> /dev/null| psub -f) 54 55isolated-tmux send-keys Enter 56tmux-sleep 57isolated-tmux capture-pane -p -S5 58# CHECK: Shutting down. 59# CHECK: prompt 1>