tide/tests/_tide_item_pwd.test.fish

53 lines
1.2 KiB
Fish
Raw Normal View History

2021-01-26 04:34:15 +03:00
# RUN: %fish %s
2020-05-09 08:48:35 +03:00
function _pwd -a dir
cd $dir
2020-05-22 00:58:09 +03:00
_tide_decolor (_tide_item_pwd)
2020-05-09 08:48:35 +03:00
end
2020-05-05 00:22:08 +03:00
2020-09-13 08:46:32 +03:00
set COLUMNS 80
2020-07-11 05:25:02 +03:00
# Unwritable directories
2020-08-11 01:11:02 +03:00
sudo mkdir -p ~/unwritable/dir # Uses sudo to make the dir unwritable
set -lx tide_pwd_unwritable_icon ''
2020-07-11 05:25:02 +03:00
2021-01-26 04:34:15 +03:00
_pwd ~/unwritable # CHECK:  ~/unwritable
_pwd ~/unwritable/dir # CHECK:  ~/unwritable/dir
2020-05-05 00:22:08 +03:00
# No icon / directories
2020-07-12 02:45:23 +03:00
set -lx tide_pwd_unwritable_icon
2021-03-02 20:46:40 +03:00
_pwd / # CHECK: /
_pwd /usr # CHECK: /usr
_pwd /usr/share # CHECK: /usr/share
2020-07-11 05:25:02 +03:00
# Normal directories
2020-08-11 01:11:02 +03:00
mkdir -p ~/normal/dir
2020-07-11 05:25:02 +03:00
2021-01-26 04:34:15 +03:00
_pwd ~ # CHECK: ~
_pwd ~/normal # CHECK: ~/normal
_pwd ~/normal/dir # CHECK: ~/normal/dir
2020-07-11 05:25:02 +03:00
rm -rf ~/normal
# Long directories
2020-05-05 00:22:08 +03:00
2021-02-11 22:34:58 +03:00
set -l longDir ~/alfa/bravo/charlie/delta/echo/foxtrot/golf/hotel/india/juliett/kilo/lima/mike/november/oscar/papa
2020-08-11 01:11:02 +03:00
mkdir -p $longDir
2021-02-11 22:34:58 +03:00
_pwd "$longDir" # CHECK: ~/a/b/c/d/e/f/g/hotel/india/juliett/kilo/lima/mike/november/oscar/papa
2020-07-11 05:25:02 +03:00
2021-02-11 22:32:06 +03:00
# Truncate to unique
mkdir -p ~/alfa/bratwurst
2021-02-11 22:34:58 +03:00
_pwd "$longDir" # CHECK: ~/a/brav/c/d/e/f/g/h/india/juliett/kilo/lima/mike/november/oscar/papa
2021-02-11 22:34:20 +03:00
rm -r ~/alfa/bratwurst
# Markers
mkdir -p ~/alfa/.git
2021-03-06 22:58:49 +03:00
_pwd "$longDir" # CHECK: ~/alfa/b/c/d/e/f/g/h/india/juliett/kilo/lima/mike/november/oscar/papa
2021-02-11 22:32:06 +03:00
2021-01-26 04:34:15 +03:00
rm -r ~/alfa