fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes Altmanningertests: filter control sequences only when interactive1e858eae3

master
819 B36 linesraw
1# RUN: %fish %s
2#
3# This deals with $PATH manipulation. We need to be careful not to step on anything.
4
5set -l tmpdir (mktemp -d)
6mkdir $tmpdir/bin
7mkdir $tmpdir/sbin
8mkdir $tmpdir/etc
9ln -s $tmpdir/bin $tmpdir/link
10
11# We set fish_user_paths to an empty global to have a starting point
12set -g fish_user_paths
13set fish_user_paths $tmpdir/bin
14
15# Confirm that it actually ends up in $PATH
16contains -- (builtin realpath $tmpdir/bin) $PATH
17and echo Have bin
18# CHECK: Have bin
19
20# Not adding duplicates
21set PATH $PATH
22set -l --path oldpath $PATH
23set -a fish_user_paths $tmpdir/bin
24test "$oldpath" = "$PATH"
25or begin
26    echo OH NO A DUPLICATE
27    echo NEW: $PATH
28    echo OLD: $oldpath
29end
30
31
32# Add a link to the same path.
33set -a fish_user_paths $tmpdir/link
34contains -- $tmpdir/link $PATH
35and echo Have bin
36# CHECK: Have bin