another couple of verbose checks; the *-global are mksh specific but work;
mksh currently fails arrassign-fnc-local (never worked either)
This commit is contained in:
parent
2ff9255f39
commit
63878e8aef
340
check.t
340
check.t
|
@ -1,4 +1,4 @@
|
|||
# $MirOS: src/bin/mksh/check.t,v 1.494 2011/11/25 23:29:31 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.495 2011/11/25 23:33:42 tg Exp $
|
||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||
|
@ -6425,6 +6425,344 @@ expected-stdout:
|
|||
1 barbaz .
|
||||
2 16#a20 .
|
||||
---
|
||||
name: arrassign-basic
|
||||
description:
|
||||
Check basic whitespace conserving properties of wdarrassign
|
||||
stdin:
|
||||
a=($(echo a b))
|
||||
b=($(echo "a b"))
|
||||
c=("$(echo "a b")")
|
||||
d=("$(echo a b)")
|
||||
a+=($(echo c d))
|
||||
b+=($(echo "c d"))
|
||||
c+=("$(echo "c d")")
|
||||
d+=("$(echo c d)")
|
||||
echo ".a:${a[0]}.${a[1]}.${a[2]}.${a[3]}:"
|
||||
echo ".b:${b[0]}.${b[1]}.${b[2]}.${b[3]}:"
|
||||
echo ".c:${c[0]}.${c[1]}.${c[2]}.${c[3]}:"
|
||||
echo ".d:${d[0]}.${d[1]}.${d[2]}.${d[3]}:"
|
||||
expected-stdout:
|
||||
.a:a.b.c.d:
|
||||
.b:a.b.c.d:
|
||||
.c:a b.c d..:
|
||||
.d:a b.c d..:
|
||||
---
|
||||
name: arrassign-fnc-none
|
||||
description:
|
||||
Check locality of array access inside a function
|
||||
stdin:
|
||||
function fn {
|
||||
x+=(f)
|
||||
echo ".fn:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
}
|
||||
function rfn {
|
||||
if [[ -n $BASH_VERSION ]]; then
|
||||
y=()
|
||||
else
|
||||
set -A y
|
||||
fi
|
||||
y+=(f)
|
||||
echo ".rfn:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
}
|
||||
x=(m m)
|
||||
y=(m m)
|
||||
echo ".f0:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
fn
|
||||
echo ".f1:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
fn
|
||||
echo ".f2:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
echo ".rf0:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
rfn
|
||||
echo ".rf1:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
rfn
|
||||
echo ".rf2:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
expected-stdout:
|
||||
.f0:m.m..:
|
||||
.fn:m.m.f.:
|
||||
.f1:m.m.f.:
|
||||
.fn:m.m.f.f:
|
||||
.f2:m.m.f.f:
|
||||
.rf0:m.m..:
|
||||
.rfn:f...:
|
||||
.rf1:f...:
|
||||
.rfn:f...:
|
||||
.rf2:f...:
|
||||
---
|
||||
name: arrassign-fnc-local
|
||||
description:
|
||||
Check locality of array access inside a function
|
||||
with the bash/mksh/ksh93 local/typeset keyword
|
||||
(note: ksh93 has no local; typeset works only in FKSH)
|
||||
stdin:
|
||||
function fn {
|
||||
typeset x
|
||||
x+=(f)
|
||||
echo ".fn:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
}
|
||||
function rfn {
|
||||
if [[ -n $BASH_VERSION ]]; then
|
||||
y=()
|
||||
else
|
||||
set -A y
|
||||
fi
|
||||
typeset y
|
||||
y+=(f)
|
||||
echo ".rfn:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
}
|
||||
function fnr {
|
||||
typeset z
|
||||
if [[ -n $BASH_VERSION ]]; then
|
||||
z=()
|
||||
else
|
||||
set -A z
|
||||
fi
|
||||
z+=(f)
|
||||
echo ".fnr:${z[0]}.${z[1]}.${z[2]}.${z[3]}:"
|
||||
}
|
||||
x=(m m)
|
||||
y=(m m)
|
||||
z=(m m)
|
||||
echo ".f0:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
fn
|
||||
echo ".f1:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
fn
|
||||
echo ".f2:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
echo ".rf0:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
rfn
|
||||
echo ".rf1:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
rfn
|
||||
echo ".rf2:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
echo ".f0r:${z[0]}.${z[1]}.${z[2]}.${z[3]}:"
|
||||
fnr
|
||||
echo ".f1r:${z[0]}.${z[1]}.${z[2]}.${z[3]}:"
|
||||
fnr
|
||||
echo ".f2r:${z[0]}.${z[1]}.${z[2]}.${z[3]}:"
|
||||
expected-stdout:
|
||||
.f0:m.m..:
|
||||
.fn:f...:
|
||||
.f1:m.m..:
|
||||
.fn:f...:
|
||||
.f2:m.m..:
|
||||
.rf0:m.m..:
|
||||
.rfn:f...:
|
||||
.rf1:...:
|
||||
.rfn:f...:
|
||||
.rf2:...:
|
||||
.f0r:m.m..:
|
||||
.fnr:f...:
|
||||
.f1r:m.m..:
|
||||
.fnr:f...:
|
||||
.f2r:m.m..:
|
||||
---
|
||||
name: arrassign-fnc-global
|
||||
description:
|
||||
Check locality of array access inside a function
|
||||
with the mksh-specific global keyword
|
||||
stdin:
|
||||
function fn {
|
||||
global x
|
||||
x+=(f)
|
||||
echo ".fn:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
}
|
||||
function rfn {
|
||||
set -A y
|
||||
global y
|
||||
y+=(f)
|
||||
echo ".rfn:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
}
|
||||
function fnr {
|
||||
global z
|
||||
set -A z
|
||||
z+=(f)
|
||||
echo ".fnr:${z[0]}.${z[1]}.${z[2]}.${z[3]}:"
|
||||
}
|
||||
x=(m m)
|
||||
y=(m m)
|
||||
z=(m m)
|
||||
echo ".f0:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
fn
|
||||
echo ".f1:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
fn
|
||||
echo ".f2:${x[0]}.${x[1]}.${x[2]}.${x[3]}:"
|
||||
echo ".rf0:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
rfn
|
||||
echo ".rf1:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
rfn
|
||||
echo ".rf2:${y[0]}.${y[1]}.${y[2]}.${y[3]}:"
|
||||
echo ".f0r:${z[0]}.${z[1]}.${z[2]}.${z[3]}:"
|
||||
fnr
|
||||
echo ".f1r:${z[0]}.${z[1]}.${z[2]}.${z[3]}:"
|
||||
fnr
|
||||
echo ".f2r:${z[0]}.${z[1]}.${z[2]}.${z[3]}:"
|
||||
expected-stdout:
|
||||
.f0:m.m..:
|
||||
.fn:m.m.f.:
|
||||
.f1:m.m.f.:
|
||||
.fn:m.m.f.f:
|
||||
.f2:m.m.f.f:
|
||||
.rf0:m.m..:
|
||||
.rfn:f...:
|
||||
.rf1:f...:
|
||||
.rfn:f...:
|
||||
.rf2:f...:
|
||||
.f0r:m.m..:
|
||||
.fnr:f...:
|
||||
.f1r:f...:
|
||||
.fnr:f...:
|
||||
.f2r:f...:
|
||||
---
|
||||
name: strassign-fnc-none
|
||||
description:
|
||||
Check locality of string access inside a function
|
||||
stdin:
|
||||
function fn {
|
||||
x+=f
|
||||
echo ".fn:$x:"
|
||||
}
|
||||
function rfn {
|
||||
y=
|
||||
y+=f
|
||||
echo ".rfn:$y:"
|
||||
}
|
||||
x=m
|
||||
y=m
|
||||
echo ".f0:$x:"
|
||||
fn
|
||||
echo ".f1:$x:"
|
||||
fn
|
||||
echo ".f2:$x:"
|
||||
echo ".rf0:$y:"
|
||||
rfn
|
||||
echo ".rf1:$y:"
|
||||
rfn
|
||||
echo ".rf2:$y:"
|
||||
expected-stdout:
|
||||
.f0:m:
|
||||
.fn:mf:
|
||||
.f1:mf:
|
||||
.fn:mff:
|
||||
.f2:mff:
|
||||
.rf0:m:
|
||||
.rfn:f:
|
||||
.rf1:f:
|
||||
.rfn:f:
|
||||
.rf2:f:
|
||||
---
|
||||
name: strassign-fnc-local
|
||||
description:
|
||||
Check locality of string access inside a function
|
||||
with the bash/mksh/ksh93 local/typeset keyword
|
||||
(note: ksh93 has no local; typeset works only in FKSH)
|
||||
stdin:
|
||||
function fn {
|
||||
typeset x
|
||||
x+=f
|
||||
echo ".fn:$x:"
|
||||
}
|
||||
function rfn {
|
||||
y=
|
||||
typeset y
|
||||
y+=f
|
||||
echo ".rfn:$y:"
|
||||
}
|
||||
function fnr {
|
||||
typeset z
|
||||
z=
|
||||
z+=f
|
||||
echo ".fnr:$z:"
|
||||
}
|
||||
x=m
|
||||
y=m
|
||||
z=m
|
||||
echo ".f0:$x:"
|
||||
fn
|
||||
echo ".f1:$x:"
|
||||
fn
|
||||
echo ".f2:$x:"
|
||||
echo ".rf0:$y:"
|
||||
rfn
|
||||
echo ".rf1:$y:"
|
||||
rfn
|
||||
echo ".rf2:$y:"
|
||||
echo ".f0r:$z:"
|
||||
fnr
|
||||
echo ".f1r:$z:"
|
||||
fnr
|
||||
echo ".f2r:$z:"
|
||||
expected-stdout:
|
||||
.f0:m:
|
||||
.fn:f:
|
||||
.f1:m:
|
||||
.fn:f:
|
||||
.f2:m:
|
||||
.rf0:m:
|
||||
.rfn:f:
|
||||
.rf1::
|
||||
.rfn:f:
|
||||
.rf2::
|
||||
.f0r:m:
|
||||
.fnr:f:
|
||||
.f1r:m:
|
||||
.fnr:f:
|
||||
.f2r:m:
|
||||
---
|
||||
name: strassign-fnc-global
|
||||
description:
|
||||
Check locality of string access inside a function
|
||||
with the mksh-specific global keyword
|
||||
stdin:
|
||||
function fn {
|
||||
global x
|
||||
x+=f
|
||||
echo ".fn:$x:"
|
||||
}
|
||||
function rfn {
|
||||
y=
|
||||
global y
|
||||
y+=f
|
||||
echo ".rfn:$y:"
|
||||
}
|
||||
function fnr {
|
||||
global z
|
||||
z=
|
||||
z+=f
|
||||
echo ".fnr:$z:"
|
||||
}
|
||||
x=m
|
||||
y=m
|
||||
z=m
|
||||
echo ".f0:$x:"
|
||||
fn
|
||||
echo ".f1:$x:"
|
||||
fn
|
||||
echo ".f2:$x:"
|
||||
echo ".rf0:$y:"
|
||||
rfn
|
||||
echo ".rf1:$y:"
|
||||
rfn
|
||||
echo ".rf2:$y:"
|
||||
echo ".f0r:$z:"
|
||||
fnr
|
||||
echo ".f1r:$z:"
|
||||
fnr
|
||||
echo ".f2r:$z:"
|
||||
expected-stdout:
|
||||
.f0:m:
|
||||
.fn:mf:
|
||||
.f1:mf:
|
||||
.fn:mff:
|
||||
.f2:mff:
|
||||
.rf0:m:
|
||||
.rfn:f:
|
||||
.rf1:f:
|
||||
.rfn:f:
|
||||
.rf2:f:
|
||||
.f0r:m:
|
||||
.fnr:f:
|
||||
.f1r:f:
|
||||
.fnr:f:
|
||||
.f2r:f:
|
||||
---
|
||||
name: varexpand-substr-1
|
||||
description:
|
||||
Check if bash-style substring expansion works
|
||||
|
|
Loading…
Reference in New Issue