mirror of
https://github.com/eth-p/bat-extras.git
synced 2024-12-15 10:40:41 +01:00
4c09718a46
- Add `-h` and `--help` flags to print out basic usage. - Refactor determine_stat_variant so that it checks to make sure the value from `stat` is a epoch timestamp, and exit noisily if it is not. - Change `determine_watcher` to set the `OPT_WATCHER` global directory directly instead of echoing it then being called from a subshell. There was an errror that the subshell was obscuring. - Add a test to reflect the bug.
33 lines
612 B
Bash
33 lines
612 B
Bash
#!/bin/bash
|
|
|
|
setup() {
|
|
use_shim 'batwatch'
|
|
}
|
|
|
|
test:version() {
|
|
description "Test 'batwatch --version'"
|
|
snapshot stdout
|
|
snapshot stderr
|
|
|
|
batwatch --version | awk 'FNR <= 1 { print $1 }'
|
|
batwatch --version | awk 'p{print} /^$/ { p=1 }'
|
|
}
|
|
|
|
test:help() {
|
|
description "Test 'batwatch --help'"
|
|
snapshot stdout
|
|
batwatch --help
|
|
|
|
assert batwatch --help
|
|
batwatch --help | grep -q 'Usage'
|
|
}
|
|
|
|
test:watcher() {
|
|
description "Test 'batwatch <file>'"
|
|
fail "No longer fails silently due to incorrect flag to stat."
|
|
|
|
# Refactored to get here, but when it passes it will loop forever.
|
|
|
|
assert batwatch $0
|
|
}
|