1 # $FreeBSD: head/bin/sh/tests/expansion/trim8.0 221646 2011-05-08 11:32:20Z jilles $
9 c2=$(printf '\303\244')
11 c3=$(printf '\342\202\254')
12 # some sort of 't' outside BMP
13 c4=$(printf '\360\235\225\245')
25 if [ "x$result" = "x$expected" ]; then
29 echo "For $code, expected $expected actual $result"
33 testcase 'set -- "$s"' "1|$s"
34 testcase 'set -- "${s#$c2}"' "1|$s"
35 testcase 'set -- "${s#*}"' "1|$s"
36 testcase 'set -- "${s#$c1}"' "1|$c2$c3$c4"
37 testcase 'set -- "${s#$c1$c2}"' "1|$c3$c4"
38 testcase 'set -- "${s#$c1$c2$c3}"' "1|$c4"
39 testcase 'set -- "${s#$c1$c2$c3$c4}"' "1|"
40 testcase 'set -- "${s#?}"' "1|$c2$c3$c4"
41 testcase 'set -- "${s#??}"' "1|$c3$c4"
42 testcase 'set -- "${s#???}"' "1|$c4"
43 testcase 'set -- "${s#????}"' "1|"
44 testcase 'set -- "${s#*$c3}"' "1|$c4"
45 testcase 'set -- "${s%$c4}"' "1|$c1$c2$c3"
46 testcase 'set -- "${s%$c3$c4}"' "1|$c1$c2"
47 testcase 'set -- "${s%$c2$c3$c4}"' "1|$c1"
48 testcase 'set -- "${s%$c1$c2$c3$c4}"' "1|"
49 testcase 'set -- "${s%?}"' "1|$c1$c2$c3"
50 testcase 'set -- "${s%??}"' "1|$c1$c2"
51 testcase 'set -- "${s%???}"' "1|$c1"
52 testcase 'set -- "${s%????}"' "1|"
53 testcase 'set -- "${s%$c2*}"' "1|$c1"
54 testcase 'set -- "${s##$c2}"' "1|$s"
55 testcase 'set -- "${s##*}"' "1|"
56 testcase 'set -- "${s##$c1}"' "1|$c2$c3$c4"
57 testcase 'set -- "${s##$c1$c2}"' "1|$c3$c4"
58 testcase 'set -- "${s##$c1$c2$c3}"' "1|$c4"
59 testcase 'set -- "${s##$c1$c2$c3$c4}"' "1|"
60 testcase 'set -- "${s##?}"' "1|$c2$c3$c4"
61 testcase 'set -- "${s##??}"' "1|$c3$c4"
62 testcase 'set -- "${s##???}"' "1|$c4"
63 testcase 'set -- "${s##????}"' "1|"
64 testcase 'set -- "${s##*$c3}"' "1|$c4"
65 testcase 'set -- "${s%%$c4}"' "1|$c1$c2$c3"
66 testcase 'set -- "${s%%$c3$c4}"' "1|$c1$c2"
67 testcase 'set -- "${s%%$c2$c3$c4}"' "1|$c1"
68 testcase 'set -- "${s%%$c1$c2$c3$c4}"' "1|"
69 testcase 'set -- "${s%%?}"' "1|$c1$c2$c3"
70 testcase 'set -- "${s%%??}"' "1|$c1$c2"
71 testcase 'set -- "${s%%???}"' "1|$c1"
72 testcase 'set -- "${s%%????}"' "1|"
73 testcase 'set -- "${s%%$c2*}"' "1|$c1"