63 lines
1.5 KiB
Bash
63 lines
1.5 KiB
Bash
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
|
|
}
|