elementary/index - [E-devel] [Patch] Add new API in Index widget (e lm_index_indicato...
[framework/uifw/elementary.git] / tests / test_setter.sh
1 #!/bin/bash
2 ret=0
3
4 BLACKLIST="tests/test_setter_blacklist.txt"
5
6 check(){
7     func=$(echo $1 | grep -oe '_\?elm_\w\+')
8     base=${func%_set}
9     cat $BLACKLIST | grep -q $func
10     if [ $? == 0 ];then
11         return
12     fi
13     echo $1 | grep -qe "_set(const \+[^\(char \+\*\)]"
14     if [ $? == 0 ];then
15         echo -e "\e[31;1mCONST\e[m\t $func"
16         ret=1
17     fi
18     echo $1 | grep -qe "EAPI \+\(void\|Eina_Bool\)"
19     if [ $? != 0 ];then
20         echo -e "\e[31;1mUNKNOWN RETURN\e[m\t $func"
21         ret=1
22     fi
23     echo $1 | grep -qe "\(cb_set\|all_set\)("
24     if [ $? != 0 ];then
25         grep -qe "EAPI.*\<${base}_get\>" $2
26         if [ $? != 0 ];then
27             echo -e "\e[31;1mMISSING GETTER\e[m\t $func"
28             ret=1
29         fi
30         echo $1 | grep -qe "\(content\|icon\|end\)_set(\w\+ \+\*obj, \w\+ \+\*\w\+);"
31         if [ $? == 0 ];then
32             grep -qe "EAPI.*\<${base}_unset\>" $2
33             if [ $? != 0 ];then
34                 echo -e "\e[31;1mMISSING UNSETTER\e[m\t $func"
35                 ret=1
36             fi
37         fi
38     fi
39 }
40
41 HEADERS="src/lib/Elementary.h.in
42 src/lib/Elementary_Cursor.h
43 src/lib/elm_widget.h"
44
45 IFS=$'\n'
46
47 for header in $HEADERS; do
48     grep -e "^ *EAPI.*(.*)" $header | grep -e 'elm_\w\+_set' >eapi.list
49
50     for i in $(cat eapi.list); do
51         check $i $header
52     done
53     rm eapi.list
54 done
55 exit $ret