FIX: media/dailymotion.lua: sequence pattern (PORTpt4)
[libquvi-scripts.git] / tests / find_tests.sh
blobd64e9f38bc54dd2ca75d3aadc46b2805134eac22
1 #!/bin/sh
3 # libquvi-scripts
4 # Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
6 # This file part of libquvi-scripts <http://quvi.sourceforge.net/>.
8 # This program is free software: you can redistribute it and/or
9 # modify it under the terms of the GNU Affero General Public
10 # License as published by the Free Software Foundation, either
11 # version 3 of the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General
19 # Public License along with this program. If not, see
20 # <http://www.gnu.org/licenses/>.
22 set -e
24 C='\n' # delimiter
25 O= # output buffer
26 T= # tests
28 dump_tests()
30 O=; for t in $T; do
31 O="$O$t$C"
32 done
33 echo "$O" | sed 's/,$//'
36 find_tests()
38 dir=`dirname $0`
39 T=`find $dir -name '*.c' -type f -exec sh -c '
40 for f; do
41 sed -n <"$f" "s/^static void \(test_.*\)()/\1/p"
42 done' _ {} +`
43 return 0
46 help()
48 echo "Usage: $0 [OPTIONS]
49 -h Show this help and exit
50 -c Use comma to separate test names"
51 exit 0
54 while [ $# -gt 0 ]
56 case "$1" in
57 -h) help;;
58 -c) C=,;;
59 *) break;;
60 esac
61 shift
62 done
64 find_tests
65 dump_tests
67 # vim: set ts=2 sw=2 tw=72 expandtab: