File: test-coverage

package info (click to toggle)
nmh 1.8-4
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 7,860 kB
  • sloc: ansic: 50,445; sh: 22,697; makefile: 1,138; lex: 740; perl: 509; yacc: 265
file content (64 lines) | stat: -rwxr-xr-x 1,795 bytes parent folder | download | duplicates (3)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh

# Tests for folder(1)'s coverage.

if test -z "${MH_OBJ_DIR}"; then
    srcdir=`dirname "$0"`/../..
    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
fi

. "$MH_OBJ_DIR/test/common.sh"

setup_test

expected="$MH_TEST_DIR/test-coverage$$.expected"
actual="$MH_TEST_DIR/test-coverage$$.actual"

check_exit '-eq 1' folder -
check_exit '-eq 1' folder -xyzzy
check_exit '-eq 0' folder -help
check_exit '-eq 0' folder -version
check_exit '-eq 1' folder -all -noall -fast -nofast -header -noheader \
    -pack -nopack -verbose -noverbose -recurse -norecurse \
    -total -nototal -print -noprint -list -nolist -push -pop -
check_exit '-eq 1' folder + @
check_exit '-eq 1' folder 42 314
check_exit '-eq 1' folder -push
check_exit '-eq 0' folder -push +
check_exit '-eq 0' folder -push +
check_exit '-eq 0' folder -push +
check_exit '-eq 0' folder -push
check_exit '-eq 1' folder -pop +foo
check_exit '-eq 0' folder -pop
check_exit '-eq 0' folder -pop
check_exit '-eq 0' folder -pop
check_exit '-eq 1' folder -pop
check_exit '-eq 1' folder -push +missing
check_exit '-eq 1' folder -nocreate +missing
check_exit '-eq 0' folder -all 1
check_exit '-eq 0' folder -all -fast +
check_exit '-eq 0' folder -pack


start_test 'skip backup file in folder'
touch `mhpath`/`mhparam sbackup`other
cat >"$expected" <<EOF
inbox+ has 10 messages  (1-10).
EOF
run_prog folder +inbox > "$actual"
check "$expected" "$actual"


start_test 'detect other files in folder'
# This test revealed bug 49476 in nmh build configured with --with-hash-backup.
[ `mhparam sbackup` = , ]  &&  prefix='#'  ||  prefix=,
touch `mhpath`/${prefix}other
cat >"$expected" <<EOF
inbox+ has 10 messages  (1-10);        (others).
EOF
run_prog folder +inbox > "$actual"
check "$expected" "$actual"


finish_test
exit ${failed:-0}