Alois Mahdal 8 лет назад
Родитель
Сommit
3af21e1578

+ 60
- 0
tests/saturnin-get/TF_RUN Просмотреть файл

@@ -0,0 +1,60 @@
1
+#!/bin/bash
2
+
3
+. "$TF_DIR/include/subtest.sh"
4
+. "$TF_DIR/include/tools.sh"
5
+
6
+tf_enum_subtests() {
7
+    echo unknown
8
+    echo unknown_dash1
9
+    echo unknown_dash2
10
+    echo unknown_none
11
+    echo unknown_same
12
+    echo shellfu_path
13
+    echo inigrep_path
14
+    echo app_version
15
+    echo cache_home
16
+    echo libexec
17
+    echo libexec_prefix
18
+# warn "unknown devel key: $key"
19
+}
20
+
21
+ckfuzzy() {
22
+    local es
23
+    local out="result/$name.stdout"
24
+    mkdir -p result
25
+    cat > "$out"
26
+    case "$name" in
27
+        shellfu_path)   grep -q '^/usr/'                  ;;
28
+        inigrep_path)   grep -q '^/usr/'                  ;;
29
+        app_version)    grep -q '[0-9]'                   ;;
30
+        cache_home)     grep -qx '/home/.*/.cache/satcmd' ;;
31
+        libexec)        grep -q '^/usr/'                  ;;
32
+        libexec_prefix) grep -q '.'                       ;;
33
+    esac <"$out"; es=$?
34
+    if test $es -gt 0;
35
+    then
36
+        tf_warn "bad output format"
37
+        cat "$out"
38
+        return "$TF_ES_FAIL"
39
+    fi
40
+}
41
+
42
+tf_do_subtest() {
43
+    local name=$1
44
+    local o_err="oracle/$name.stderr"
45
+    case $name in
46
+        unknown)        tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get-foo             ;;
47
+        unknown_dash1)  tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get--               ;;
48
+        unknown_dash2)  tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get---              ;;
49
+        unknown_none)   tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get-                ;;
50
+        unknown_same)   tf_testflt -n "$name" -E "$o_err" -S 2 satcmd --saturnin-get---saturnin-get  ;;
51
+        shellfu_path)   satcmd --saturnin-get-shellfu-path    | ckfuzzy ;;
52
+        inigrep_path)   satcmd --saturnin-get-inigrep-path    | ckfuzzy ;;
53
+        app_version)    satcmd --saturnin-get-app-version     | ckfuzzy ;;
54
+        cache_home)     satcmd --saturnin-get-cache-home      | ckfuzzy ;;
55
+        libexec)        satcmd --saturnin-get-libexec         | ckfuzzy ;;
56
+        libexec_prefix) satcmd --saturnin-get-libexec-prefix  | ckfuzzy ;;
57
+    esac
58
+}
59
+
60
+tf_do_subtests

+ 1
- 0
tests/saturnin-get/oracle/unknown.stderr Просмотреть файл

@@ -0,0 +1 @@
1
+unknown devel key: foo

+ 1
- 0
tests/saturnin-get/oracle/unknown_dash1.stderr Просмотреть файл

@@ -0,0 +1 @@
1
+unknown devel key: -

+ 1
- 0
tests/saturnin-get/oracle/unknown_dash2.stderr Просмотреть файл

@@ -0,0 +1 @@
1
+unknown devel key: --

+ 1
- 0
tests/saturnin-get/oracle/unknown_none.stderr Просмотреть файл

@@ -0,0 +1 @@
1
+unknown devel key: 

+ 1
- 0
tests/saturnin-get/oracle/unknown_same.stderr Просмотреть файл

@@ -0,0 +1 @@
1
+unknown devel key: --saturnin-get

+ 6
- 0
tests/saturnin-get/test/ALL.stdin Просмотреть файл

@@ -0,0 +1,6 @@
1
+Alice uses Google.
2
+Bob wears goggles.
3
+Joe and John are friends.
4
+Linda and Nina work together.
5
+The mask *.* matches all.
6
+The mask *.docx matches Word documents.