a b/tests/langparser1/langparser1.sh
1
#!/bin/sh
2
3
# langparser actually test queries. We only test the language parser, the tested reference is the Xapian query.
4
5
topdir=`dirname $0`/..
6
. $topdir/shared.sh
7
8
initvariables $0
9
xrun()
10
{
11
    echo $*
12
    $*
13
}
14
15
(
16
    for Q in  \
17
    'A' \
18
    'A B' \
19
    'A AND B' \
20
    'A OR B' \
21
    'A OR B AND C' \
22
    'A AND B OR C' \
23
    '(A AND B) OR (C AND D)' \
24
    '(A OR B) AND (C OR D)' \
25
    '-the B' \
26
    'A -B' \
27
    'mime:text/plain' \
28
    'size>10k' \
29
    'date:3000-01-01' \
30
    'mime:text/plain A OR B mime:text/html' \
31
    'mime:text/plain A AND B mime:text/html' \
32
    'mime:text/plain mime:text/html (A B) ' \
33
    'mime:text/plain OR mime:text/html OR (A B) ' \
34
    'rclcat:media A' \
35
    'rclcat:media rclcat:message A' \
36
    'A size>10k' \
37
    'size>10k A' \
38
    'date:3000-01-01 A' \
39
    'A OR B date:3000-01-01' \
40
    'A OR B AND date:3000-01-01' \
41
    'title:A B' \
42
    'title:A -B' \
43
    'A -title:B' \
44
    ; do
45
        # The " $Q" is there to avoid issue with a query beginning with -
46
        # (recollq does not grok --)
47
        printf "%60s" "Query: $Q -> ";recollq -Q -q " $Q"
48
    done
49
)  2> $mystderr | egrep -v 'results|^Query setup took' > $mystdout
50
51
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1
52
53
checkresult