sh: Add some tests for ${#parameter}.
This commit is contained in:
parent
5921b7ea2e
commit
18584d14e3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219611
12
tools/regression/bin/sh/expansion/length1.0
Normal file
12
tools/regression/bin/sh/expansion/length1.0
Normal file
@ -0,0 +1,12 @@
|
||||
# $FreeBSD$
|
||||
|
||||
v=abcd
|
||||
[ "${#v}" = 4 ] || echo '${#v} wrong'
|
||||
v=$$
|
||||
[ "${#$}" = "${#v}" ] || echo '${#$} wrong'
|
||||
[ "${#!}" = 0 ] || echo '${#!} wrong'
|
||||
set -- 01 2 3 4 5 6 7 8 9 10 11 12 0013
|
||||
[ "${#1}" = 2 ] || echo '${#1} wrong'
|
||||
[ "${#13}" = 4 ] || echo '${#13} wrong'
|
||||
v=$0
|
||||
[ "${#0}" = "${#v}" ] || echo '${#0} wrong'
|
4
tools/regression/bin/sh/expansion/length2.0
Normal file
4
tools/regression/bin/sh/expansion/length2.0
Normal file
@ -0,0 +1,4 @@
|
||||
# $FreeBSD$
|
||||
|
||||
v=$-
|
||||
[ "${#-}" = "${#v}" ] || echo '${#-} wrong'
|
10
tools/regression/bin/sh/expansion/length3.0
Normal file
10
tools/regression/bin/sh/expansion/length3.0
Normal file
@ -0,0 +1,10 @@
|
||||
# $FreeBSD$
|
||||
|
||||
set -- 1 2 3 4 5 6 7 8 9 10 11 12 13
|
||||
[ "$#" = 13 ] || echo '$# wrong'
|
||||
[ "${#}" = 13 ] || echo '${#} wrong'
|
||||
[ "${##}" = 2 ] || echo '${##} wrong'
|
||||
set --
|
||||
[ "$#" = 0 ] || echo '$# wrong'
|
||||
[ "${#}" = 0 ] || echo '${#} wrong'
|
||||
[ "${##}" = 1 ] || echo '${##} wrong'
|
Loading…
Reference in New Issue
Block a user