|
3 | 3 | load './util/init.sh' |
4 | 4 |
|
5 | 5 | @test "Advanced errors with no start dot 1" { |
6 | | - run bash_object.parse_filter -s '' |
| 6 | + run bash_object.parse_filter --simple '' |
7 | 7 |
|
8 | 8 | assert_failure |
9 | 9 | assert_line -p "Filter must begin with a dot" |
10 | 10 | } |
11 | 11 |
|
12 | 12 | @test "Advanced errors with no start dot 2" { |
13 | | - run bash_object.parse_filter -a '["sub"]' |
| 13 | + run bash_object.parse_filter --advanced '["sub"]' |
14 | 14 |
|
15 | 15 | assert_failure |
16 | 16 | assert_line -p "Filter must begin with a dot" |
17 | 17 | } |
18 | 18 |
|
19 | 19 | @test "Advanced errors with missing dot" { |
20 | | - run bash_object.parse_filter -a '.["one"]["two"]' |
| 20 | + run bash_object.parse_filter --advanced '.["one"]["two"]' |
21 | 21 |
|
22 | 22 | assert_failure |
23 | 23 | assert_line -p "Each part in a filter must be deliminated by a dot" |
24 | 24 | } |
25 | 25 |
|
26 | 26 | @test "Advanced errors with trailing dot" { |
27 | | - run bash_object.parse_filter -a '.["one"].["ab"].' |
| 27 | + run bash_object.parse_filter --advanced '.["one"].["ab"].' |
28 | 28 |
|
29 | 29 | assert_failure |
30 | 30 | assert_line -p "A dot MUST be followed by an opening bracket" |
31 | 31 | } |
32 | 32 |
|
33 | 33 | @test "Advanced errors with trailing double dot" { |
34 | | - run bash_object.parse_filter -a '.["one"].["ab"]..' |
| 34 | + run bash_object.parse_filter --advanced '.["one"].["ab"]..' |
35 | 35 |
|
36 | 36 | assert_failure |
37 | 37 | assert_line -p "A dot MUST be followed by an opening bracket" |
38 | 38 | } |
39 | 39 |
|
40 | 40 | @test "Advanced errors on incomplete 1" { |
41 | | - run bash_object.parse_filter -a '.[' |
| 41 | + run bash_object.parse_filter --advanced '.[' |
42 | 42 |
|
43 | 43 | assert_failure |
44 | 44 | assert_line -p "A number or opening quote must follow an open bracket" |
45 | 45 | } |
46 | 46 |
|
47 | 47 | @test "Advanced errors on incomplete 2" { |
48 | | - run bash_object.parse_filter -a '.["' |
| 48 | + run bash_object.parse_filter --advanced '.["' |
49 | 49 |
|
50 | 50 | assert_failure |
51 | 51 | assert_line -p "Filter is not complete" |
52 | 52 | } |
53 | 53 |
|
54 | 54 | @test "Advanced errors on incomplete 3" { |
55 | | - run bash_object.parse_filter -a '.[""' |
| 55 | + run bash_object.parse_filter --advanced '.[""' |
56 | 56 |
|
57 | 57 | assert_failure |
58 | 58 | assert_line -p "Key cannot be empty" |
59 | 59 | } |
60 | 60 |
|
61 | 61 | @test "Advanced errors on incomplete 4" { |
62 | | - run bash_object.parse_filter -a '.["bottom"].["' |
| 62 | + run bash_object.parse_filter --advanced '.["bottom"].["' |
63 | 63 |
|
64 | 64 | assert_failure |
65 | 65 | assert_line -p "Filter is not complete" |
66 | 66 | } |
67 | 67 |
|
68 | 68 | @test "Advanced errors on incomplete 5" { |
69 | | - run bash_object.parse_filter -a '.["top"].[""' |
| 69 | + run bash_object.parse_filter --advanced '.["top"].[""' |
70 | 70 |
|
71 | 71 | assert_failure |
72 | 72 | assert_line -p "Key cannot be empty" |
73 | 73 | } |
74 | 74 |
|
75 | 75 | @test "Advanced errors on empty key" { |
76 | | - run bash_object.parse_filter -a '.[""]' |
| 76 | + run bash_object.parse_filter --advanced '.[""]' |
77 | 77 |
|
78 | 78 | assert_failure |
79 | 79 | assert_line -p "Key cannot be empty" |
80 | 80 | } |
81 | 81 |
|
82 | 82 | @test "Advanced errors on empty key as subkey" { |
83 | | - run bash_object.parse_filter -a '.["subkey"].[""]' |
| 83 | + run bash_object.parse_filter --advanced '.["subkey"].[""]' |
84 | 84 |
|
85 | 85 | assert_failure |
86 | 86 | assert_line -p "Key cannot be empty" |
87 | 87 | } |
88 | 88 |
|
89 | 89 | @test "Advanced errors on empty number key" { |
90 | | - run bash_object.parse_filter -a '.[]' |
| 90 | + run bash_object.parse_filter --advanced '.[]' |
91 | 91 |
|
92 | 92 | assert_failure |
93 | 93 | assert_line -p "Key cannot be empty" |
94 | 94 | } |
95 | 95 |
|
96 | 96 | @test "Advanced errors on empty key as number subkey" { |
97 | | - run bash_object.parse_filter -a '.["subkey"].[]' |
| 97 | + run bash_object.parse_filter --advanced '.["subkey"].[]' |
98 | 98 |
|
99 | 99 | assert_failure |
100 | 100 | assert_line -p "Key cannot be empty" |
101 | 101 | } |
102 | 102 |
|
103 | 103 | @test "Correctly parses advanced prop" { |
104 | | - bash_object.parse_filter -a '.["one"]' |
| 104 | + bash_object.parse_filter --advanced '.["one"]' |
105 | 105 |
|
106 | 106 | assert [ "${#REPLIES[@]}" -eq 1 ] |
107 | 107 | assert [ "${REPLIES[0]}" = 'one' ] |
108 | 108 | } |
109 | 109 |
|
110 | 110 | @test "Correctly parses advanced prop and escape sequence" { |
111 | | - bash_object.parse_filter -a '.["esca\\p\"\]e"]' |
| 111 | + bash_object.parse_filter --advanced '.["esca\\p\"\]e"]' |
112 | 112 |
|
113 | 113 | assert [ "${#REPLIES[@]}" -eq 1 ] |
114 | 114 | assert [ "${REPLIES[0]}" = 'esca\p"]e' ] |
115 | 115 | } |
116 | 116 |
|
117 | 117 | @test "Correctly parses advanced double prop" { |
118 | | - bash_object.parse_filter -a '.["aone"].["a\\two"]' |
| 118 | + bash_object.parse_filter --advanced '.["aone"].["a\\two"]' |
119 | 119 |
|
120 | 120 | assert [ "${#REPLIES[@]}" -eq 2 ] |
121 | 121 | assert [ "${REPLIES[0]}" = 'aone' ] |
122 | 122 | assert [ "${REPLIES[1]}" = 'a\two' ] |
123 | 123 | } |
124 | 124 |
|
125 | 125 | @test "Correctly parses advanced number single" { |
126 | | - bash_object.parse_filter -a '.[3]' |
| 126 | + bash_object.parse_filter --advanced '.[3]' |
127 | 127 |
|
128 | 128 | assert [ "${#REPLIES[@]}" -eq 1 ] |
129 | 129 | assert [ "${REPLIES[0]}" = $'\x1C3' ] |
130 | 130 | } |
131 | 131 |
|
132 | 132 | @test "Correctly parses advanced number" { |
133 | | - bash_object.parse_filter -a '.[341]' |
| 133 | + bash_object.parse_filter --advanced '.[341]' |
134 | 134 |
|
135 | 135 | assert [ "${#REPLIES[@]}" -eq 1 ] |
136 | 136 | assert [ "${REPLIES[0]}" = $'\x1C341' ] |
137 | 137 | } |
138 | 138 |
|
139 | 139 | @test "Correctly parses advanced number nested" { |
140 | | - bash_object.parse_filter -a '.[341].[7]' |
| 140 | + bash_object.parse_filter --advanced '.[341].[7]' |
141 | 141 |
|
142 | 142 | assert [ "${#REPLIES[@]}" -eq 2 ] |
143 | 143 | assert [ "${REPLIES[0]}" = $'\x1C341' ] |
144 | 144 | assert [ "${REPLIES[1]}" = $'\x1C7' ] |
145 | 145 | } |
146 | 146 |
|
147 | 147 | @test "Correctly parses advanced number then string" { |
148 | | - bash_object.parse_filter -a '.[3].["subprop"]' |
| 148 | + bash_object.parse_filter --advanced '.[3].["subprop"]' |
149 | 149 |
|
150 | 150 | assert [ "${#REPLIES[@]}" -eq 2 ] |
151 | 151 | assert [ "${REPLIES[0]}" = $'\x1C3' ] |
152 | 152 | assert [ "${REPLIES[1]}" = 'subprop' ] |
153 | 153 | } |
154 | 154 |
|
155 | 155 | @test "Correctly parses advanced string then number" { |
156 | | - bash_object.parse_filter -a '.["subprop"].[9]' |
| 156 | + bash_object.parse_filter --advanced '.["subprop"].[9]' |
157 | 157 |
|
158 | 158 | assert [ "${#REPLIES[@]}" -eq 2 ] |
159 | 159 | assert [ "${REPLIES[0]}" = 'subprop' ] |
|
0 commit comments