blob: 0f9b78649da07a1cb69fd255fdbc03f9ff41bb39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/bin/sh
#
# Prepares the data from testfiles/list for tests in QML in the same way as
# tst_QMimeDatabase::findByFileName_data() for C++.
# For QML, instead of passing the data in QTest columns the data is passed
# via the JavaScript include file testdata_list.js.
#
doit()
{
SRCDIR=../qmimedatabase/
prefix=$SRCDIR"testfiles/"
f=$prefix"list"
cat $f | while read line; do
if [ "`echo $line | cut -c3-`" = "" -o "`echo $line | cut -c1`" = "#" ]; then
true
else
set $line
if [ $# -ge 2 ]; then
filePath=$1
mimeType=$2
xFail=$3
if [ "$isFirst" != "" ]; then
echo -n " "
echo -n ", "
else
isFirst="notIsFirst"
echo "function list() {"
echo " return ["
echo -n " "
fi
echo "{ filePath: \"$prefix$filePath\", mimeType: \"$mimeType\", xFail: \"$xFail\" }"
else
echo "Illegal line: $line" >&2
fi
fi
done
echo " ]"
echo "}"
}
doit > testdata_list.js
|