aboutsummaryrefslogtreecommitdiff
path: root/testsuite/parse.tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/parse.tests')
-rwxr-xr-xtestsuite/parse.tests44
1 files changed, 37 insertions, 7 deletions
diff --git a/testsuite/parse.tests b/testsuite/parse.tests
index 904e1a17a..2cbed6f31 100755
--- a/testsuite/parse.tests
+++ b/testsuite/parse.tests
@@ -5,13 +5,13 @@
5 5
6. ./testing.sh 6. ./testing.sh
7 7
8COLLAPSE=$(( 0x00010000)) 8COLLAPSE=$(( 0x00010000))
9TRIM=$(( 0x00020000)) 9TRIM=$(( 0x00020000))
10GREEDY=$(( 0x00040000)) 10GREEDY=$(( 0x00040000))
11MIN_DIE=$(( 0x00100000)) 11MIN_DIE=$(( 0x00100000))
12KEEP_COPY=$((0x00200000)) 12KEEP_COPY=$(( 0x00200000))
13ESCAPE=$(( 0x00400000)) 13EOL_COMMENTS=$((0x00400000))
14NORMAL=$(( COLLAPSE | TRIM | GREEDY)) 14NORMAL=$(( COLLAPSE | TRIM | GREEDY | EOL_COMMENTS))
15 15
16# testing "description" "command" "result" "infile" "stdin" 16# testing "description" "command" "result" "infile" "stdin"
17 17
@@ -27,6 +27,34 @@ testing "parse notrim" \
27 "-" \ 27 "-" \
28 " sda 0:0 644 @echo @echo TEST \n" 28 " sda 0:0 644 @echo @echo TEST \n"
29 29
30testing "parse comments" \
31 "parse -n 4 -m 3 -f $((NORMAL - EOL_COMMENTS)) -" \
32 "[sda][0:0][644][@echo @echo TEST #this is not eaten]\n" \
33 "-" \
34 "\
35# sda 0:0 644 @echo @echo TEST - this gets eaten
36 sda 0:0 644 @echo @echo TEST #this is not eaten
37"
38
39testing "parse bad comment" \
40 "parse -n 2 -m 2 -d '#=' -f $((GREEDY)) - 2>&1" \
41 "\
42[var][val]
43parse: bad line 3: 1 tokens found, 2 needed
44[ #this][ok]
45[ #this][=ok]
46[ #this][=ok=ok=ok=]
47" \
48 "-" \
49 "\
50# this gets eaten
51var=val
52 #this causes error msg
53 #this=ok
54 #this==ok
55 #this==ok=ok=ok=
56"
57
30FILE=__parse 58FILE=__parse
31cat >$FILE <<EOF 59cat >$FILE <<EOF
32# 60#
@@ -96,6 +124,8 @@ cat >$FILE.res <<EOF
96[option][dns][129.219.13.81] 124[option][dns][129.219.13.81]
97[option][domain][local] 125[option][domain][local]
98[option][lease][864000] 126[option][lease][864000]
127[option][msstaticroutes][10.0.0.0/8][10.127.0.1]
128[option][staticroutes][10.0.0.0/8][10.127.0.1,][10.11.12.0/24][10.11.12.1]
99[option][0x08][01020304] 129[option][0x08][01020304]
100EOF 130EOF
101 131