argcv.at
2.27 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
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 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/>.
dnl ------------------------------------------------------------
dnl TESTARGS([NAME], [KW = `'], [INPUT], [STDOUT = `'],
dnl [STDERR = `'], [RUN-IF-FAIL], [RUN-IF-PASS])
dnl
m4_pushdef([TESTARGS],[
m4_pushdef([MU_TEST_GROUP],[Argcv])
m4_pushdef([MU_TEST_KEYWORDS],[argcv])
m4_pushdef([MU_TEST_COMMAND],[argcv])
MU_GENERIC_TEST([$1],[$2],[$3],[],[$4],[$5])
m4_popdef([MU_TEST_COMMAND])
m4_popdef([MU_TEST_KEYWORDS])
m4_popdef([MU_TEST_GROUP])
])
dnl ------------------------------------------------------------
TESTARGS([simple input],[],
[1 2 3],
[3: 1 2 3
])
TESTARGS([quoted space],[],
[quoted\ space],
[1: "quoted space"
])
TESTARGS([tab character],[],
[a "tab character"],
[2: a tab\tcharacter
])
TESTARGS([octal and hex escapes],[],
[\157\143\164\141\154\40and\x20\x68\x65\x78],
[1: "octal and hex"
])
TESTARGS([octal and hex escapes 2],[],
[\157\143\164\141\154\40 and \x20\x68\x65\x78],
[3: "octal " and " hex"
])
TESTARGS([escape representation],[],
[A\x3-\48\39],
[1: A\003-\0048\0039
])
TESTARG([8-bit input],[],
[×ÅÒÈÎÑÑ ÐÏÌÏ×ÉÎÁ ÔÁÂÌÉÃÙ],
[3: \327\305\322\310\316\321\321 \320\317\314\317\327\311\316\301 \324\301\302\314\311\303\331])
TESTARG([misquoted input],[],
[messed up'quotations ' in "a single'" "command" lin"e],
[6: messed "upquotations " in "a single'" command "lin\"e"
])
TESTARG([unbalanced quote],[],
['unbalanced "quote],
[2: 'unbalanced "\"quote"
])
TESTARG([unbalanced quote 2],[],
[unbalanced "quote],
[2: unbalanced "\"quote"
])
TESTARG([unbalanced quote 3],[],
["],
[1: "\""
])
m4_popdef([TESTARGS])