add, with a warning, regression testcases for:
• trailing combining character • ${!#} and friends the warning is: pid_t is signed (so PIDs could be negative) and may be rather long, in some cases even longer than a C “long”; we’ll need to handle this by adding checks (sizeof pid_t=gid_t, sizeof pid_t must be either mksh_ari_t or u_short) and code (always print $$/$! as unsigned, set unsigned attribute on $BASHPID and friends)
This commit is contained in:
71
check.t
71
check.t
@@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.730 2016/04/14 15:38:36 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.731 2016/05/05 22:58:19 tg Exp $
|
||||||
# -*- mode: sh -*-
|
# -*- mode: sh -*-
|
||||||
#-
|
#-
|
||||||
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
# (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
# (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R52 2016/04/14
|
@(#)MIRBSD KSH R52 2016/05/05
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@@ -39,7 +39,7 @@ name: KSH_VERSION
|
|||||||
category: shell:legacy-no
|
category: shell:legacy-no
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R52 2016/04/14
|
@(#)LEGACY KSH R52 2016/05/05
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
@@ -1687,6 +1687,50 @@ stdin:
|
|||||||
expected-stdout:
|
expected-stdout:
|
||||||
<~/x> </x> <~> <\~> <~><~> <~/x> <~//etc> <~/~>
|
<~/x> </x> <~> <\~> <~><~> <~/x> <~//etc> <~/~>
|
||||||
---
|
---
|
||||||
|
name: expand-bang-1
|
||||||
|
description:
|
||||||
|
Check corner case of ${!?} with ! being var vs. op
|
||||||
|
stdin:
|
||||||
|
echo ${!?}
|
||||||
|
expected-exit: 1
|
||||||
|
expected-stderr-pattern: /not set/
|
||||||
|
---
|
||||||
|
name: expand-bang-2
|
||||||
|
description:
|
||||||
|
Check corner case of ${!var} vs. ${var op} with var=!
|
||||||
|
stdin:
|
||||||
|
echo 1 $! .
|
||||||
|
echo 2 ${!#} .
|
||||||
|
echo 3 ${!#[0-9]} .
|
||||||
|
echo 4 ${!-foo} .
|
||||||
|
# get an at least three-digit bg pid
|
||||||
|
while :; do
|
||||||
|
:&
|
||||||
|
x=$!
|
||||||
|
if [[ $x != +([0-9]) ]]; then
|
||||||
|
echo >&2 "cannot test, pid '$x' not numeric"
|
||||||
|
echo >&2 report this with as many details as possible
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
[[ $x = [0-9][0-9][0-9]* ]] && break
|
||||||
|
done
|
||||||
|
y=${x#?}
|
||||||
|
t=$!; [[ $t = $x ]]; echo 5 $? .
|
||||||
|
t=${!#}; [[ $t = $x ]]; echo 6 $? .
|
||||||
|
t=${!#[0-9]}; [[ $t = $y ]]; echo 7 $? .
|
||||||
|
t=${!-foo}; [[ $t = $x ]]; echo 8 $? .
|
||||||
|
t=${!?bar}; [[ $t = $x ]]; echo 9 $? .
|
||||||
|
expected-stdout:
|
||||||
|
1 .
|
||||||
|
2 .
|
||||||
|
3 .
|
||||||
|
4 foo .
|
||||||
|
5 0 .
|
||||||
|
6 0 .
|
||||||
|
7 0 .
|
||||||
|
8 0 .
|
||||||
|
9 0 .
|
||||||
|
---
|
||||||
name: expand-number-1
|
name: expand-number-1
|
||||||
description:
|
description:
|
||||||
Check that positional arguments do not overflow
|
Check that positional arguments do not overflow
|
||||||
@@ -7806,6 +7850,27 @@ expected-stdout:
|
|||||||
2 off
|
2 off
|
||||||
3 done
|
3 done
|
||||||
---
|
---
|
||||||
|
name: utf8bug-1
|
||||||
|
description:
|
||||||
|
Ensure trailing combining characters are not lost
|
||||||
|
stdin:
|
||||||
|
set -U
|
||||||
|
a=a
|
||||||
|
b=$'\u0301'
|
||||||
|
x=$a$b
|
||||||
|
print -r -- "<e$x>"
|
||||||
|
x=$a
|
||||||
|
x+=$b
|
||||||
|
print -r -- "<e$x>"
|
||||||
|
b=$'\u0301'b
|
||||||
|
x=$a
|
||||||
|
x+=$b
|
||||||
|
print -r -- "<e$x>"
|
||||||
|
expected-stdout:
|
||||||
|
<eá>
|
||||||
|
<eá>
|
||||||
|
<eáb>
|
||||||
|
---
|
||||||
name: aliases-1
|
name: aliases-1
|
||||||
description:
|
description:
|
||||||
Check if built-in shell aliases are okay
|
Check if built-in shell aliases are okay
|
||||||
|
Reference in New Issue
Block a user