quvi/util.lua: Remove unused choose_format
[libquvi-scripts.git] / tests / find_tests.sh
blob3a546dafbcfd3903948d9d544df1370a95fc8e29
1 #!/bin/sh
3 # libquvi-scripts
4 # Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301 USA
21 set -e
23 C='\n' # delimiter
24 O= # output buffer
25 T= # tests
27 dump_tests()
29 O=; for t in $T; do
30 O="$O$t$C"
31 done
32 echo "$O" | sed 's/,$//'
35 find_tests()
37 dir=`dirname $0`
38 T=`find $dir -name '*.c' -type f -exec sh -c '
39 for f; do
40 sed -n <"$f" "s/^static void \(test_.*\)()/\1/p"
41 done' _ {} +`
42 return 0
45 help()
47 echo "Usage: $0 [OPTIONS]
48 -h Show this help and exit
49 -c Use comma to separate test names"
50 exit 0
53 while [ $# -gt 0 ]
55 case "$1" in
56 -h) help;;
57 -c) C=,;;
58 *) break;;
59 esac
60 shift
61 done
63 find_tests
64 dump_tests
66 # vim: set ts=2 sw=2 tw=72 expandtab: