Switch to GNU stow

This commit is contained in:
Marty Oehme 2019-12-29 23:12:13 +01:00
parent a2605c4254
commit d34cecb27e
137 changed files with 39244 additions and 141 deletions

View file

@ -0,0 +1,63 @@
setup() {
fut="$BATS_TEST_DIRNAME/../dimswitch"
}
@test "[-v flag] Displays version information" {
run $fut -v
[ "$status" -eq 0 ]
match='^.* [0-9]\.[0-9]\.[0-9]$'
echo $output
if echo "$output" | grep "$match";then true;else false; fi
}
@test "[--version flag] Displays version information" {
run $fut --version
[ "$status" -eq 0 ]
match='^.* [0-9]\.[0-9]\.[0-9]$'
echo $output
if echo "$output" | grep "$match";then true;else false; fi
}
@test "[-h flag] Displays usage information" {
run $fut -h
[ "$status" -eq 0 ]
match='^.*Usage:.*$'
echo $output
if echo "$output" | grep "$match";then true;else false; fi
}
@test "[--help flag] Displays usage information" {
run $fut --help
[ "$status" -eq 0 ]
match='^.*Usage:.*$'
echo $output
if echo "$output" | grep "$match";then true;else false; fi
}
#### _findfile
@test "[-i flag] Displays config file for alacritty" {
export DIM_PROGRAMS="alacritty"
export DIM_ALACRITTY_CONF="$BATS_TEST_DIRNAME/files/alacritty_conf.yml"
run $fut -i
[ "$status" -eq 0 ]
match="^alacritty - $DIM_ALACRITTY_CONF"
echo $output
if echo "$output" | grep "$match";then true;else false;fi
}
@test "[-i flag] Displays error if no config file found" {
export DIM_PROGRAMS="alacritty"
export DIM_ALACRITTY_CONF="$BATS_TEST_DIRNAME/files/nonexisting_alacritty_conf.yml"
run $fut -i
[ "$status" -eq 0 ]
match="^alacritty - No associated configuration file found."
echo $output
if echo "$output" | grep "$match";then true;else false;fi
}

View file

@ -0,0 +1,39 @@
setup() {
fut="$BATS_TEST_DIRNAME/../tm"
}
teardown() {
rm -rf $BATS_TMPDIR/xdg/*
}
@test "runs correctly if invoked without arguments" {
run $fut
echo "$BATS_TEST_DIRNAME/../tm"
[ "$status" -eq 0 ]
}
@test "Errors out if passed a non-existent session file (and some session name)" {
run $fut IDONT_EXIST_HERE.session sessionname
echo "STATUS: $output"
[ "$status" -eq 1 ]
echo "OUTPUT: $output"
[ "$output" = "can not source session file: 'IDONT_EXIST_HERE.session' does not exist." ]
}
@test "Runs without errors when session file exists in PWD" {
touch $PWD/exists.session
run $fut exists.session sessionname
rm $PWD/exists.session
[ "$status" -eq 0 ]
}
@test "Runs without errors when session file exists in XDG_CONFIG_HOME/tmux/sessions/" {
export XDG_CONFIG_HOME=$BATS_TMPDIR
mkdir -p $XDG_CONFIG_HOME/tmux/sessions
sesdir=$XDG_CONFIG_HOME/tmux/sessions
touch $sesdir/exists.session
run $fut exists.session sessionname
[ "$status" -eq 0 ]
}