prop.at
2.6 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2010 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
# This file is part of Mailfromd testsuite.
dnl ------------------------------------------------------------------
dnl TESTPROP([NAME], [KW = `'], [PROG], [STDOUT = `'], [STDERR = `'])
dnl
m4_pushdef([TESTPROP],[
AT_SETUP([prop: $1])
AT_KEYWORDS([prop $2])
AT_CHECK([$3],[0],[$4],[$5])
AT_CLEANUP])
TESTPROP([set],[prop00],[
prop foo=bar ?foo +foo
],
[0: foo=bar: Success
1: foo is set
2: foo=bar
])
TESTPROP([overwrite],[prop01],[
prop foo=bar foo=baz +foo
],
[0: foo=bar: Success
1: foo=baz: Success
2: foo=baz
])
TESTPROP([set without overwrite],[prop03],[
prop foo=bar foo:=baz +foo
],
[0: foo=bar: Success
1: foo=baz: Item already exists
2: foo=bar
])
TESTPROP([set/unset],[prop04],[
prop foo=bar ?foo +foo -foo ?foo
],
[0: foo=bar: Success
1: foo is set
2: foo=bar
3: unset foo: Success
4: foo is not set
])
TESTPROP([read/save],[prop06],[
prop --file=db user=gray package=mailutils org=GNU test=6.a
if test -f db; then
prop --file=db | sort
else
echo 2>&1 "failed to create file"
exit 1
fi
prop --file=db -test
prop --file=db | sort
prop --file=db test=6.b descr="New test"
prop --file=db | sort
],
[0: user=gray: Success
1: package=mailutils: Success
2: org=GNU: Success
3: test=6.a: Success
Property dump:
org=GNU
package=mailutils
test=6.a
user=gray
0: unset test: Success
Property dump:
org=GNU
package=mailutils
user=gray
0: test=6.b: Success
1: descr=New test: Success
Property dump:
descr=New test
org=GNU
package=mailutils
test=6.b
user=gray
])
TESTPROP([clear],[prop07],[
prop --dump user=gray package=mailutils org=GNU 0 ?org
],
[0: user=gray: Success
1: package=mailutils: Success
2: org=GNU: Success
3: clear: Success
4: org is not set
Property dump:
])
TESTPROP([invalidate],[prop08],[
prop --file=db user=foo
prop --file=db ?user user=bar +user '!' +user
],
[0: user=foo: Success
0: user is set
1: user=bar: Success
2: user=bar
3: invalidate: Success
4: user=foo
])
m4_popdef([TESTPROP])