| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | #!/bin/bash
. "$TF_DIR/include/subtest.sh"
. "$TF_DIR/include/tools.sh"
tf_enum_subtests() {
    echo unknown
    echo unknown_dash1
    echo unknown_dash2
    echo unknown_none
    echo unknown_same
    echo shellfu_path
    echo saturnin_conf_path
    echo app_version
    echo cache_home
    echo libexec
    echo libexec_prefix
# warn "unknown devel key: $key"
}
ckfuzzy() {
    local es
    local out="result/$name.stdout"
    mkdir -p result
    cat > "$out"
    case "$name" in
        shellfu_path)   grep -q '^/usr/'                  ;;
        saturnin_conf_path)  tr : '\n' | grep -q '^/usr/' ;;
        app_version)    grep -q '[0-9]'                   ;;
        cache_home)     grep -qx '/home/.*/.cache/satcmd' ;;
        libexec)        grep -q '^/usr/'                  ;;
        libexec_prefix) grep -q '.'                       ;;
    esac <"$out"; es=$?
    if test $es -gt 0;
    then
        tf_warn "bad output format"
        cat "$out"
        return "$TF_ES_FAIL"
    fi
}
tf_do_subtest() {
    local name=$1
    local o_err="oracle/$name.stderr"
    case $name in
        unknown)        tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get-foo             ;;
        unknown_dash1)  tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get--               ;;
        unknown_dash2)  tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get---              ;;
        unknown_none)   tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get-                ;;
        unknown_same)   tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get---saturnin-get  ;;
        shellfu_path)   satcmd --saturnin-get-shellfu-path    | ckfuzzy ;;
        saturnin_conf_path)   satcmd --saturnin-get-saturnin-conf-path | ckfuzzy ;;
        app_version)    satcmd --saturnin-get-app-version     | ckfuzzy ;;
        cache_home)     satcmd --saturnin-get-cache-home      | ckfuzzy ;;
        libexec)        satcmd --saturnin-get-libexec         | ckfuzzy ;;
        libexec_prefix) satcmd --saturnin-get-libexec-prefix  | ckfuzzy ;;
    esac
}
tf_do_subtests
 |