diff options
Diffstat (limited to 'testsuite/parse.tests')
-rwxr-xr-x | testsuite/parse.tests | 44 |
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 | ||
8 | COLLAPSE=$(( 0x00010000)) | 8 | COLLAPSE=$(( 0x00010000)) |
9 | TRIM=$(( 0x00020000)) | 9 | TRIM=$(( 0x00020000)) |
10 | GREEDY=$(( 0x00040000)) | 10 | GREEDY=$(( 0x00040000)) |
11 | MIN_DIE=$(( 0x00100000)) | 11 | MIN_DIE=$(( 0x00100000)) |
12 | KEEP_COPY=$((0x00200000)) | 12 | KEEP_COPY=$(( 0x00200000)) |
13 | ESCAPE=$(( 0x00400000)) | 13 | EOL_COMMENTS=$((0x00400000)) |
14 | NORMAL=$(( COLLAPSE | TRIM | GREEDY)) | 14 | NORMAL=$(( 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 | ||
30 | testing "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 | |||
39 | testing "parse bad comment" \ | ||
40 | "parse -n 2 -m 2 -d '#=' -f $((GREEDY)) - 2>&1" \ | ||
41 | "\ | ||
42 | [var][val] | ||
43 | parse: 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 | ||
51 | var=val | ||
52 | #this causes error msg | ||
53 | #this=ok | ||
54 | #this==ok | ||
55 | #this==ok=ok=ok= | ||
56 | " | ||
57 | |||
30 | FILE=__parse | 58 | FILE=__parse |
31 | cat >$FILE <<EOF | 59 | cat >$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] |
100 | EOF | 130 | EOF |
101 | 131 | ||