Debian Codegraph @

debian/tests/test_find_item_in_list

raw
1 #!/bin/sh -e
2 # UI test
3 # (C) 2026 Osamu Aoki <[email protected]>, GPL-2+
4 #
5 # dash_test_find_item_in_list with dash
6 #: >TMP
7 dash_test_find_item_in_list () {
8 RESULT=$(XDG_SESSION_TYPE=x11 im-config -t find_item_in_list "$1" "$2" && echo -n "TRUE" || echo -n "FALSE")
9 if [ "$RESULT" != "$3" ]; then
10 echo -n "*"
11 #echo "TEST_AS_FALSE: find_item_in_list '$1' '$2' EXPECT='$3' != RESULT='$RESULT'" >>TMP
12 #else
13 #echo "TEST_AS_TRUE: find_item_in_list '$1' '$2' EXPECT='$3' == RESULT='$RESULT'" >>TMP
14 fi
15 }
16
17 ERRORS=""
18 ERRORS="$ERRORS$(dash_test_find_item_in_list "" "" "FALSE")"
19 ERRORS="$ERRORS$(dash_test_find_item_in_list "" "GNOME" "FALSE")"
20 ERRORS="$ERRORS$(dash_test_find_item_in_list "" "ANY" "FALSE")"
21 ERRORS="$ERRORS$(dash_test_find_item_in_list "" "except:GNOME" "FALSE")"
22 ERRORS="$ERRORS$(dash_test_find_item_in_list "GNOME" "" "FALSE")"
23 ERRORS="$ERRORS$(dash_test_find_item_in_list "GNOME" "GNOME" "TRUE")"
24 ERRORS="$ERRORS$(dash_test_find_item_in_list "GNOME" "A:B" "FALSE")"
25 ERRORS="$ERRORS$(dash_test_find_item_in_list "GNOME" "A:GNOME" "TRUE")"
26 ERRORS="$ERRORS$(dash_test_find_item_in_list "GNOME" "ANY" "TRUE")"
27 ERRORS="$ERRORS$(dash_test_find_item_in_list "GNOME" "except:GNOME" "FALSE")"
28 ERRORS="$ERRORS$(dash_test_find_item_in_list "GNOME" "except:KDE:GNOME" "FALSE")"
29 ERRORS="$ERRORS$(dash_test_find_item_in_list "XFCE" "except:KDE:GNOME" "TRUE")"
30 #rm -f $HOME/.xinputrc
31 echo "ERRORS='$ERRORS'"
32 #echo "=== LOG === >>>"
33 #cat TMP
34 #echo "=== LOG === <<<"
35
36 if [ -z "$ERRORS" ]; then
37 echo "SUCCESS"
38 exit 0
39 else
40 echo "FAILURE"
41 exit 1
42 fi
43