@@ -100,6 +100,11 @@ fn test_parenthesis() {
100
100
. args ( & [ "(" , "1" , "+" , "1" , ")" , "*" , "2" ] )
101
101
. succeeds ( )
102
102
. stdout_only ( "4\n " ) ;
103
+
104
+ new_ucmd ! ( )
105
+ . args ( & [ "1" , "(" , ")" ] )
106
+ . fails ( )
107
+ . stderr_only ( "expr: syntax error (operation should be prefix)\n " ) ;
103
108
}
104
109
105
110
#[ test]
@@ -221,6 +226,11 @@ fn test_index() {
221
226
. args ( & [ "index" , "αbcdef_f" , "f" ] )
222
227
. succeeds ( )
223
228
. stdout_only ( "6\n " ) ;
229
+
230
+ new_ucmd ! ( )
231
+ . args ( & [ "αbcdef" , "index" , "α" ] )
232
+ . fails ( )
233
+ . stderr_only ( "expr: syntax error (operation should be prefix)\n " ) ;
224
234
}
225
235
226
236
#[ test]
@@ -234,6 +244,11 @@ fn test_length() {
234
244
. args ( & [ "length" , "abcdef" ] )
235
245
. succeeds ( )
236
246
. stdout_only ( "6\n " ) ;
247
+
248
+ new_ucmd ! ( )
249
+ . args ( & [ "abcdef" , "length" ] )
250
+ . fails ( )
251
+ . stderr_only ( "expr: syntax error (operation should be prefix)\n " ) ;
237
252
}
238
253
239
254
#[ test]
@@ -271,6 +286,11 @@ fn test_substr() {
271
286
. args ( & [ "substr" , "abc" , "1" , "1" ] )
272
287
. succeeds ( )
273
288
. stdout_only ( "a\n " ) ;
289
+
290
+ new_ucmd ! ( )
291
+ . args ( & [ "abc" , "substr" , "1" , "1" ] )
292
+ . fails ( )
293
+ . stderr_only ( "expr: syntax error (operation should be prefix)\n " ) ;
274
294
}
275
295
276
296
#[ test]
0 commit comments