ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/vendor/MirOS/mksh/dist/check.t
(Generate patch)

Comparing vendor/MirOS/mksh/dist/check.t (file contents):
Revision 6978 by laffer1, Sat Oct 11 12:24:56 2014 UTC vs.
Revision 6979 by laffer1, Fri Mar 20 00:51:13 2015 UTC

# Line 1 | Line 1
1 < # $MirOS: src/bin/mksh/check.t,v 1.661 2014/10/07 15:22:14 tg Exp $
2 < # OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44
1 > # $MirOS: src/bin/mksh/check.t,v 1.667.2.3 2015/03/01 15:42:51 tg Exp $
2 > # -*- mode: sh -*-
3   #-
4   # Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
5 < #             2011, 2012, 2013, 2014
5 > #             2011, 2012, 2013, 2014, 2015
6   #       Thorsten Glaser <tg@mirbsd.org>
7   #
8   # Provided that these terms and disclaimer and all copyright notices
# Line 24 | Line 24
24   # http://www.research.att.com/~gsf/public/ifs.sh
25   #
26   # More testsuites at:
27 < # http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
27 > # http://svnweb.freebsd.org/base/head/bin/test/tests/legacy_test.sh?view=co&content-type=text%2Fplain
28 > #
29 > # Integrated testsuites from:
30 > # (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
31  
32   expected-stdout:
33 <        @(#)MIRBSD KSH R50 2014/10/07
33 >        @(#)MIRBSD KSH R50 2015/03/01
34   description:
35          Check version of shell.
36   stdin:
# Line 36 | Line 39 | name: KSH_VERSION
39   category: shell:legacy-no
40   ---
41   expected-stdout:
42 <        @(#)LEGACY KSH R50 2014/10/07
42 >        @(#)LEGACY KSH R50 2015/03/01
43   description:
44          Check version of legacy shell.
45   stdin:
# Line 2359 | Line 2362 | stdin:
2362   expected-stdout:
2363          baz
2364   ---
2365 + name: heredoc-9f
2366 + description:
2367 +        Check long here strings
2368 + stdin:
2369 +        cat <<< "$(  :                                                             )aa"
2370 + expected-stdout:
2371 +        aa
2372 + ---
2373   name: heredoc-10
2374   description:
2375          Check direct here document assignment
# Line 2389 | Line 2400 | stdin:
2400          vf=<<<$'=f $x \x40='
2401          # now check
2402          print -r -- "| va={$va} vb={$vb} vc={$vc} vd={$vd} ve={$ve} vf={$vf} |"
2403 +        # check append
2404 +        v=<<-EOF
2405 +                vapp1
2406 +        EOF
2407 +        v+=<<-EOF
2408 +                vapp2
2409 +        EOF
2410 +        print -r -- "| ${v//$'\n'/^} |"
2411   expected-stdout:
2412          function foo {
2413                  vc=<<-EOF
# Line 2404 | Line 2423 | expected-stdout:
2423          } ve={=e $x \x40=
2424          } vf={=f $x @=
2425          } |
2426 +        | vapp1^vapp2^ |
2427   ---
2428   name: heredoc-11
2429   description:
# Line 2433 | Line 2453 | stdin:
2453          eval "$fnd"
2454          foo
2455          print -r -- "| va={$va} vb={$vb} vc={$vc} vd={$vd} |"
2456 +        # check append
2457 +        v=<<-
2458 +                vapp1
2459 +        <<
2460 +        v+=<<-''
2461 +                vapp2
2462 +        
2463 +        print -r -- "| ${v//$'\n'/^} |"
2464   expected-stdout:
2465          function foo {
2466                  vc=<<-
# Line 2450 | Line 2478 | expected-stdout:
2478          } vc={=c u \x40=
2479          } vd={=d $x \x40=
2480          } |
2481 +        | vapp1^vapp2^ |
2482   ---
2483 + name: heredoc-12
2484 + description:
2485 +        Check here documents can use $* and $@; note shells vary:
2486 +        • pdksh 5.2.14 acts the same
2487 +        • dash has 1 and 2 the same but 3 lacks the space
2488 +        • ksh93, bash4 differ in 2 by using space ipv colon
2489 + stdin:
2490 +        set -- a b
2491 +        nl='
2492 +        '
2493 +        IFS="   $nl"; n=1
2494 +        cat <<EOF
2495 +        $n foo $* foo
2496 +        $n bar "$*" bar
2497 +        $n baz $@ baz
2498 +        $n bla "$@" bla
2499 +        EOF
2500 +        IFS=":"; n=2
2501 +        cat <<EOF
2502 +        $n foo $* foo
2503 +        $n bar "$*" bar
2504 +        $n baz $@ baz
2505 +        $n bla "$@" bla
2506 +        EOF
2507 +        IFS=; n=3
2508 +        cat <<EOF
2509 +        $n foo $* foo
2510 +        $n bar "$*" bar
2511 +        $n baz $@ baz
2512 +        $n bla "$@" bla
2513 +        EOF
2514 + expected-stdout:
2515 +        1 foo a b foo
2516 +        1 bar "a b" bar
2517 +        1 baz a b baz
2518 +        1 bla "a b" bla
2519 +        2 foo a:b foo
2520 +        2 bar "a:b" bar
2521 +        2 baz a:b baz
2522 +        2 bla "a:b" bla
2523 +        3 foo a b foo
2524 +        3 bar "a b" bar
2525 +        3 baz a b baz
2526 +        3 bla "a b" bla
2527 + ---
2528   name: heredoc-comsub-1
2529   description:
2530          Tests for here documents in COMSUB, taken from Austin ML
# Line 3585 | Line 3659 | name: IFS-space-1
3659   description:
3660          Simple test, default IFS
3661   stdin:
3662 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3662 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3663          set -- A B C
3664          showargs 1 $*
3665          showargs 2 "$*"
3666          showargs 3 $@
3667          showargs 4 "$@"
3668   expected-stdout:
3669 <         <1> <A> <B> <C>
3670 <         <2> <A B C>
3671 <         <3> <A> <B> <C>
3672 <         <4> <A> <B> <C>
3669 >        <1> <A> <B> <C> .
3670 >        <2> <A B C> .
3671 >        <3> <A> <B> <C> .
3672 >        <4> <A> <B> <C> .
3673   ---
3674   name: IFS-colon-1
3675   description:
3676          Simple test, IFS=:
3677   stdin:
3678 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3678 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3679          IFS=:
3680          set -- A B C
3681          showargs 1 $*
# Line 3609 | Line 3683 | stdin:
3683          showargs 3 $@
3684          showargs 4 "$@"
3685   expected-stdout:
3686 <         <1> <A> <B> <C>
3687 <         <2> <A:B:C>
3688 <         <3> <A> <B> <C>
3689 <         <4> <A> <B> <C>
3686 >        <1> <A> <B> <C> .
3687 >        <2> <A:B:C> .
3688 >        <3> <A> <B> <C> .
3689 >        <4> <A> <B> <C> .
3690   ---
3691   name: IFS-null-1
3692   description:
3693          Simple test, IFS=""
3694   stdin:
3695 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3695 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3696          IFS=""
3697          set -- A B C
3698          showargs 1 $*
# Line 3626 | Line 3700 | stdin:
3700          showargs 3 $@
3701          showargs 4 "$@"
3702   expected-stdout:
3703 <         <1> <A> <B> <C>
3704 <         <2> <ABC>
3705 <         <3> <A> <B> <C>
3706 <         <4> <A> <B> <C>
3703 >        <1> <A> <B> <C> .
3704 >        <2> <ABC> .
3705 >        <3> <A> <B> <C> .
3706 >        <4> <A> <B> <C> .
3707   ---
3708   name: IFS-space-colon-1
3709   description:
3710          Simple test, IFS=<white-space>:
3711   stdin:
3712 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3712 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3713          IFS="$IFS:"
3714          set --
3715          showargs 1 $*
# Line 3644 | Line 3718 | stdin:
3718          showargs 4 "$@"
3719          showargs 5 : "$@"
3720   expected-stdout:
3721 <         <1>
3722 <         <2> <>
3723 <         <3>
3724 <         <4>
3725 <         <5> <:>
3721 >        <1> .
3722 >        <2> <> .
3723 >        <3> .
3724 >        <4> .
3725 >        <5> <:> .
3726   ---
3727   name: IFS-space-colon-2
3728   description:
3729          Simple test, IFS=<white-space>:
3730          AT&T ksh fails this, POSIX says the test is correct.
3731   stdin:
3732 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3732 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3733          IFS="$IFS:"
3734          set --
3735          showargs :"$@"
3736   expected-stdout:
3737 <         <:>
3737 >        <:> .
3738   ---
3739   name: IFS-space-colon-4
3740   description:
3741          Simple test, IFS=<white-space>:
3742   stdin:
3743 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3743 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3744          IFS="$IFS:"
3745          set --
3746          showargs "$@$@"
3747   expected-stdout:
3748 <        
3748 >        .
3749   ---
3750   name: IFS-space-colon-5
3751   description:
3752          Simple test, IFS=<white-space>:
3753          Don't know what POSIX thinks of this.  AT&T ksh does not do this.
3754   stdin:
3755 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3755 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3756          IFS="$IFS:"
3757          set --
3758          showargs "${@:-}"
3759   expected-stdout:
3760 <         <>
3760 >        <> .
3761   ---
3762   name: IFS-subst-1
3763   description:
3764          Simple test, IFS=<white-space>:
3765   stdin:
3766 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3766 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3767          IFS="$IFS:"
3768          x=":b: :"
3769          echo -n '1:'; for i in $x ; do echo -n " [$i]" ; done ; echo
# Line 3711 | Line 3785 | stdin:
3785   expected-stdout:
3786          1: [] [b] []
3787          2: [:b::]
3788 <         <3> <> <b> <>
3789 <         <4> <:b::>
3788 >        <3> <> <b> <> .
3789 >        <4> <:b::> .
3790          5: [a] [b]
3791 <         <6> <a> <b>
3791 >        <6> <a> <b> .
3792          7: [a] [] [c]
3793 <         <8> <a> <> <c>
3793 >        <8> <a> <> <c> .
3794          9: [h] [ith] [ere]
3795 <         <10> <h> <ith> <ere>
3796 <         <11> <h:ith:ere>
3795 >        <10> <h> <ith> <ere> .
3796 >        <11> <h:ith:ere> .
3797          12: [A] [B] [] [D]
3798 <         <13> <A> <B> <> <D>
3798 >        <13> <A> <B> <> <D> .
3799   ---
3800   name: IFS-subst-2
3801   description:
3802          Check leading whitespace after trim does not make a field
3803   stdin:
3804 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3804 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3805          x="X 1 2"
3806          showargs 1 shift ${x#X}
3807   expected-stdout:
3808 <         <1> <shift> <1> <2>
3808 >        <1> <shift> <1> <2> .
3809   ---
3810 < name: IFS-subst-3
3810 > name: IFS-subst-3-arr
3811   description:
3812          Check leading IFS non-whitespace after trim does make a field
3813          but leading IFS whitespace does not, nor empty replacements
3814   stdin:
3815 <        showargs() { for i; do echo -n " <$i>"; done; echo; }
3815 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3816          showargs 0 ${-+}
3817          IFS=:
3818          showargs 1 ${-+:foo:bar}
3819          IFS=' '
3820          showargs 2 ${-+ foo bar}
3821   expected-stdout:
3822 <         <0>
3823 <         <1> <> <foo> <bar>
3824 <         <2> <foo> <bar>
3822 >        <0> .
3823 >        <1> <> <foo> <bar> .
3824 >        <2> <foo> <bar> .
3825   ---
3826 + name: IFS-subst-3-ass
3827 + description:
3828 +        Check non-field semantics
3829 + stdin:
3830 +        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
3831 +        showargs 0 x=${-+}
3832 +        IFS=:
3833 +        showargs 1 x=${-+:foo:bar}
3834 +        IFS=' '
3835 +        showargs 2 x=${-+ foo bar}
3836 + expected-stdout:
3837 +        <0> <x=> .
3838 +        <1> <x=> <foo> <bar> .
3839 +        <2> <x=> <foo> <bar> .
3840 + ---
3841 + name: IFS-subst-3-lcl
3842 + description:
3843 +        Check non-field semantics, smaller corner case (LP#1381965)
3844 + stdin:
3845 +        set -x
3846 +        local regex=${2:-}
3847 +        exit 1
3848 + expected-exit: e != 0
3849 + expected-stderr-pattern:
3850 +        /regex=/
3851 + ---
3852   name: IFS-subst-4-1
3853   description:
3854          reported by mikeserv
3855   stdin:
3856 +        pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
3857          a='space divded  argument
3858          here'
3859          IFS=\  ; set -- $a
3860          IFS= ; q="$*" ; nq=$*
3861 <        printf '<%s>\n' "$*" $* "$q" "$nq"
3861 >        pfn "$*" $* "$q" "$nq"
3862          [ "$q" = "$nq" ] && echo =true || echo =false
3863   expected-stdout:
3864          <spacedivdedargument
# Line 3776 | Line 3877 | name: IFS-subst-4-2
3877   description:
3878          extended testsuite based on problem by mikeserv
3879   stdin:
3880 +        pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
3881          a='space divded  argument
3882          here'
3883          IFS=\  ; set -- $a
3884          IFS= ; q="$@" ; nq=$@
3885 <        printf '<%s>\n' "$*" $* "$q" "$nq"
3885 >        pfn "$*" $* "$q" "$nq"
3886          [ "$q" = "$nq" ] && echo =true || echo =false
3887   expected-stdout:
3888          <spacedivdedargument
# Line 3799 | Line 3901 | name: IFS-subst-4-3
3901   description:
3902          extended testsuite based on problem by mikeserv
3903   stdin:
3904 +        pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
3905          a='space divded  argument
3906          here'
3907          IFS=\ ; set -- $a; IFS=
# Line 3806 | Line 3909 | stdin:
3909          nqs=$*
3910          qk="$@"
3911          nqk=$@
3912 <        printf '= qs '; printf '<%s>\n' "$qs"
3913 <        printf '=nqs '; printf '<%s>\n' "$nqs"
3914 <        printf '= qk '; printf '<%s>\n' "$qk"
3915 <        printf '=nqk '; printf '<%s>\n' "$nqk"
3916 <        printf '~ qs '; printf '<%s>\n' "$*"
3917 <        printf '~nqs '; printf '<%s>\n' $*
3918 <        printf '~ qk '; printf '<%s>\n' "$@"
3919 <        printf '~nqk '; printf '<%s>\n' $@
3912 >        print -nr -- '= qs '; pfn "$qs"
3913 >        print -nr -- '=nqs '; pfn "$nqs"
3914 >        print -nr -- '= qk '; pfn "$qk"
3915 >        print -nr -- '=nqk '; pfn "$nqk"
3916 >        print -nr -- '~ qs '; pfn "$*"
3917 >        print -nr -- '~nqs '; pfn $*
3918 >        print -nr -- '~ qk '; pfn "$@"
3919 >        print -nr -- '~nqk '; pfn $@
3920   expected-stdout:
3921          = qs <spacedivdedargument
3922          here>
# Line 3842 | Line 3945 | name: IFS-subst-4-4
3945   description:
3946          extended testsuite based on problem by mikeserv
3947   stdin:
3948 +        pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
3949          a='space divded  argument
3950          here'
3951          IFS=\ ; set -- $a; IFS=
3952          qs="$*"
3953 <        printf '= qs '; printf '<%s>\n' "$qs"
3954 <        printf '~ qs '; printf '<%s>\n' "$*"
3953 >        print -nr -- '= qs '; pfn "$qs"
3954 >        print -nr -- '~ qs '; pfn "$*"
3955          nqs=$*
3956 <        printf '=nqs '; printf '<%s>\n' "$nqs"
3957 <        printf '~nqs '; printf '<%s>\n' $*
3956 >        print -nr -- '=nqs '; pfn "$nqs"
3957 >        print -nr -- '~nqs '; pfn $*
3958          qk="$@"
3959 <        printf '= qk '; printf '<%s>\n' "$qk"
3960 <        printf '~ qk '; printf '<%s>\n' "$@"
3959 >        print -nr -- '= qk '; pfn "$qk"
3960 >        print -nr -- '~ qk '; pfn "$@"
3961          nqk=$@
3962 <        printf '=nqk '; printf '<%s>\n' "$nqk"
3963 <        printf '~nqk '; printf '<%s>\n' $@
3962 >        print -nr -- '=nqk '; pfn "$nqk"
3963 >        print -nr -- '~nqk '; pfn $@
3964   expected-stdout:
3965          = qs <spacedivdedargument
3966          here>
# Line 3885 | Line 3989 | name: IFS-subst-4-4p
3989   description:
3990          extended testsuite based on problem by mikeserv
3991   stdin:
3992 +        pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
3993          a='space divded  argument
3994          here'
3995          IFS=\ ; set -- $a; IFS=
3996          unset v
3997          qs=${v:-"$*"}
3998 <        printf '= qs '; printf '<%s>\n' "$qs"
3999 <        printf '~ qs '; printf '<%s>\n' ${v:-"$*"}
3998 >        print -nr -- '= qs '; pfn "$qs"
3999 >        print -nr -- '~ qs '; pfn ${v:-"$*"}
4000          nqs=${v:-$*}
4001 <        printf '=nqs '; printf '<%s>\n' "$nqs"
4002 <        printf '~nqs '; printf '<%s>\n' ${v:-$*}
4001 >        print -nr -- '=nqs '; pfn "$nqs"
4002 >        print -nr -- '~nqs '; pfn ${v:-$*}
4003          qk=${v:-"$@"}
4004 <        printf '= qk '; printf '<%s>\n' "$qk"
4005 <        printf '~ qk '; printf '<%s>\n' ${v:-"$@"}
4004 >        print -nr -- '= qk '; pfn "$qk"
4005 >        print -nr -- '~ qk '; pfn ${v:-"$@"}
4006          nqk=${v:-$@}
4007 <        printf '=nqk '; printf '<%s>\n' "$nqk"
4008 <        printf '~nqk '; printf '<%s>\n' ${v:-$@}
4007 >        print -nr -- '=nqk '; pfn "$nqk"
4008 >        print -nr -- '~nqk '; pfn ${v:-$@}
4009   expected-stdout:
4010          = qs <spacedivdedargument
4011          here>
# Line 3929 | Line 4034 | name: IFS-subst-4-5
4034   description:
4035          extended testsuite based on problem by mikeserv
4036   stdin:
4037 +        pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4038          a='space divded  argument
4039          here'
4040          IFS=\ ; set -- $a; IFS=,
4041          qs="$*"
4042 <        printf '= qs '; printf '<%s>\n' "$qs"
4043 <        printf '~ qs '; printf '<%s>\n' "$*"
4042 >        print -nr -- '= qs '; pfn "$qs"
4043 >        print -nr -- '~ qs '; pfn "$*"
4044          nqs=$*
4045 <        printf '=nqs '; printf '<%s>\n' "$nqs"
4046 <        printf '~nqs '; printf '<%s>\n' $*
4045 >        print -nr -- '=nqs '; pfn "$nqs"
4046 >        print -nr -- '~nqs '; pfn $*
4047          qk="$@"
4048 <        printf '= qk '; printf '<%s>\n' "$qk"
4049 <        printf '~ qk '; printf '<%s>\n' "$@"
4048 >        print -nr -- '= qk '; pfn "$qk"
4049 >        print -nr -- '~ qk '; pfn "$@"
4050          nqk=$@
4051 <        printf '=nqk '; printf '<%s>\n' "$nqk"
4052 <        printf '~nqk '; printf '<%s>\n' $@
4051 >        print -nr -- '=nqk '; pfn "$nqk"
4052 >        print -nr -- '~nqk '; pfn $@
4053   expected-stdout:
4054          = qs <space,divded,argument
4055          here>
# Line 3972 | Line 4078 | name: IFS-subst-4-5p
4078   description:
4079          extended testsuite based on problem by mikeserv
4080   stdin:
4081 +        pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; }
4082          a='space divded  argument
4083          here'
4084          IFS=\ ; set -- $a; IFS=,
4085          unset v
4086          qs=${v:-"$*"}
4087 <        printf '= qs '; printf '<%s>\n' "$qs"
4088 <        printf '~ qs '; printf '<%s>\n' ${v:-"$*"}
4087 >        print -nr -- '= qs '; pfn "$qs"
4088 >        print -nr -- '~ qs '; pfn ${v:-"$*"}
4089          nqs=${v:-$*}
4090 <        printf '=nqs '; printf '<%s>\n' "$nqs"
4091 <        printf '~nqs '; printf '<%s>\n' ${v:-$*}
4090 >        print -nr -- '=nqs '; pfn "$nqs"
4091 >        print -nr -- '~nqs '; pfn ${v:-$*}
4092          qk=${v:-"$@"}
4093 <        printf '= qk '; printf '<%s>\n' "$qk"
4094 <        printf '~ qk '; printf '<%s>\n' ${v:-"$@"}
4093 >        print -nr -- '= qk '; pfn "$qk"
4094 >        print -nr -- '~ qk '; pfn ${v:-"$@"}
4095          nqk=${v:-$@}
4096 <        printf '=nqk '; printf '<%s>\n' "$nqk"
4097 <        printf '~nqk '; printf '<%s>\n' ${v:-$@}
4096 >        print -nr -- '=nqk '; pfn "$nqk"
4097 >        print -nr -- '~nqk '; pfn ${v:-$@}
4098   expected-stdout:
4099          = qs <space,divded,argument
4100          here>
# Line 4026 | Line 4133 | description:
4133          'emulate sh' zsh has extra fields in
4134          - a5ins (IFS_NWS unquoted $*)
4135          - b5ins, matching mksh’s
4136 +        !!WARNING!! more to come: http://austingroupbugs.net/view.php?id=888
4137   stdin:
4138 <        "$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"'
4138 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4139 >                IFS=; set -- "" 2 ""; pfb $*; x=$*; pfn "$x"'
4140          echo '=a1zns'
4141 <        "$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"'
4141 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4142 >                IFS=; set -- "" 2 ""; pfb "$*"; x="$*"; pfn "$x"'
4143          echo '=a2zqs'
4144 <        "$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"'
4144 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4145 >                IFS=; set -- "" 2 ""; pfb $@; x=$@; pfn "$x"'
4146          echo '=a3zna'
4147 <        "$__progname" -c 'IFS=; set -- "" 2 ""; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"'
4147 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4148 >                IFS=; set -- "" 2 ""; pfb "$@"; x="$@"; pfn "$x"'
4149          echo '=a4zqa'
4150 <        "$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"'
4150 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4151 >                IFS=,; set -- "" 2 ""; pfb $*; x=$*; pfn "$x"'
4152          echo '=a5ins'
4153 <        "$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"'
4153 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4154 >                IFS=,; set -- "" 2 ""; pfb "$*"; x="$*"; pfn "$x"'
4155          echo '=a6iqs'
4156 <        "$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"'
4156 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4157 >                IFS=,; set -- "" 2 ""; pfb $@; x=$@; pfn "$x"'
4158          echo '=a7ina'
4159 <        "$__progname" -c 'IFS=,; set -- "" 2 ""; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"'
4159 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4160 >                IFS=,; set -- "" 2 ""; pfb "$@"; x="$@"; pfn "$x"'
4161          echo '=a8iqa'
4162 <        "$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"'
4162 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4163 >                IFS=; set -- A B "" "" C; pfb $*; x=$*; pfn "$x"'
4164          echo '=b1zns'
4165 <        "$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"'
4165 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4166 >                IFS=; set -- A B "" "" C; pfb "$*"; x="$*"; pfn "$x"'
4167          echo '=b2zqs'
4168 <        "$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"'
4168 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4169 >                IFS=; set -- A B "" "" C; pfb $@; x=$@; pfn "$x"'
4170          echo '=b3zna'
4171 <        "$__progname" -c 'IFS=; set -- A B "" "" C; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"'
4171 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4172 >                IFS=; set -- A B "" "" C; pfb "$@"; x="$@"; pfn "$x"'
4173          echo '=b4zqa'
4174 <        "$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" $*; x=$*; printf "<%s>\n" "$x"'
4174 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4175 >                IFS=,; set -- A B "" "" C; pfb $*; x=$*; pfn "$x"'
4176          echo '=b5ins'
4177 <        "$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" "$*"; x="$*"; printf "<%s>\n" "$x"'
4177 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4178 >                IFS=,; set -- A B "" "" C; pfb "$*"; x="$*"; pfn "$x"'
4179          echo '=b6iqs'
4180 <        "$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" $@; x=$@; printf "<%s>\n" "$x"'
4180 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4181 >                IFS=,; set -- A B "" "" C; pfb $@; x=$@; pfn "$x"'
4182          echo '=b7ina'
4183 <        "$__progname" -c 'IFS=,; set -- A B "" "" C; printf "[%s]\n" "$@"; x="$@"; printf "<%s>\n" "$x"'
4183 >        "$__progname" -c 'pfb() { for s_arg in "$@"; do print -r -- "[$s_arg]"; done; }; pfn() { for s_arg in "$@"; do print -r -- "<$s_arg>"; done; };
4184 >                IFS=,; set -- A B "" "" C; pfb "$@"; x="$@"; pfn "$x"'
4185          echo '=b8iqa'
4186   expected-stdout:
4187          [2]
# Line 4133 | Line 4257 | expected-stdout:
4257          <A B   C>
4258          =b8iqa
4259   ---
4260 + name: IFS-subst-6
4261 + description:
4262 +        Regression wrt. vector expansion in trim
4263 + stdin:
4264 +        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4265 +        IFS=
4266 +        x=abc
4267 +        set -- a b
4268 +        showargs ${x#$*}
4269 + expected-stdout:
4270 +        <c> .
4271 + ---
4272 + name: IFS-subst-7
4273 + description:
4274 +        ksh93 bug wrt. vector expansion in trim
4275 + stdin:
4276 +        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4277 +        IFS="*"
4278 +        a=abcd
4279 +        set -- '' c
4280 +        showargs "$*" ${a##"$*"}
4281 + expected-stdout:
4282 +        <*c> <abcd> .
4283 + ---
4284 + name: IFS-subst-8
4285 + description:
4286 +        http://austingroupbugs.net/view.php?id=221
4287 + stdin:
4288 +        n() { echo "$#"; }; n "${foo-$@}"
4289 + expected-stdout:
4290 +        1
4291 + ---
4292 + name: IFS-subst-9
4293 + description:
4294 +        Scalar context for $*/$@ in [[ and case
4295 + stdin:
4296 +        "$__progname" -c 'IFS=; set a b; [[ $* = "$1$2" ]]; echo 1 $?' sh a b
4297 +        "$__progname" -c 'IFS=; [[ $* = ab ]]; echo 2 "$?"' sh a b
4298 +        "$__progname" -c 'IFS=; [[ "$*" = ab ]]; echo 3 "$?"' sh a b
4299 +        "$__progname" -c 'IFS=; [[ $* = a ]]; echo 4 "$?"' sh a b
4300 +        "$__progname" -c 'IFS=; [[ "$*" = a ]]; echo 5 "$?"' sh a b
4301 +        "$__progname" -c 'IFS=; [[ "$@" = a ]]; echo 6 "$?"' sh a b
4302 +        "$__progname" -c 'IFS=; case "$@" in a) echo 7 a;; ab) echo 7 b;; a\ b) echo 7 ok;; esac' sh a b
4303 +        "$__progname" -c 'IFS=; case $* in a) echo 8 a;; ab) echo 8 ok;; esac' sh a b
4304 +        "$__progname" -c 'pfsp() { for s_arg in "$@"; do print -nr -- "<$s_arg> "; done; print .; }; IFS=; star=$* at="$@"; pfsp 9 "$star" "$at"' sh a b
4305 + expected-stdout:
4306 +        1 0
4307 +        2 0
4308 +        3 0
4309 +        4 1
4310 +        5 1
4311 +        6 1
4312 +        7 ok
4313 +        8 ok
4314 +        <9> <ab> <a b> .
4315 + ---
4316   name: IFS-arith-1
4317   description:
4318          http://austingroupbugs.net/view.php?id=832
4319   stdin:
4320          ${ZSH_VERSION+false} || emulate sh
4321          ${BASH_VERSION+set -o posix}
4322 <        showargs() { for x in "$@"; do echo -n "<$x> "; done; echo .; }
4322 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
4323          IFS=0
4324          showargs $((1230456))
4325   expected-stdout:
# Line 7063 | Line 7243 | description:
7243          XXX if the OS can already execute them, we lose
7244          note: cygwin execve(2) doesn't return to us with ENOEXEC, we lose
7245          note: Ultrix perl5 t4 returns 65280 (exit-code 255) and no text
7246 +        XXX fails when LD_PRELOAD is set with -e and Perl chokes it (ASan)
7247   need-pass: no
7248   category: !os:cygwin,!os:msys,!os:ultrix,!os:uwin-nt,!smksh
7249   env-setup: !FOO=BAR!
# Line 8013 | Line 8194 | expected-stdout:
8194          .fnr:f:
8195          .f2r:f:
8196   ---
8197 + name: unset-fnc-local-ksh
8198 + description:
8199 +        Check that “unset” removes a previous “local”
8200 +        (ksh93 syntax compatible version); apparently,
8201 +        there are shells which fail this?
8202 + stdin:
8203 +        function f {
8204 +                echo f0: $x
8205 +                typeset x
8206 +                echo f1: $x
8207 +                x=fa
8208 +                echo f2: $x
8209 +                unset x
8210 +                echo f3: $x
8211 +                x=fb
8212 +                echo f4: $x
8213 +        }
8214 +        x=o
8215 +        echo before: $x
8216 +        f
8217 +        echo after: $x
8218 + expected-stdout:
8219 +        before: o
8220 +        f0: o
8221 +        f1:
8222 +        f2: fa
8223 +        f3: o
8224 +        f4: fb
8225 +        after: fb
8226 + ---
8227 + name: unset-fnc-local-sh
8228 + description:
8229 +        Check that “unset” removes a previous “local”
8230 +        (Debian Policy §10.4 sh version); apparently,
8231 +        there are shells which fail this?
8232 + stdin:
8233 +        f() {
8234 +                echo f0: $x
8235 +                local x
8236 +                echo f1: $x
8237 +                x=fa
8238 +                echo f2: $x
8239 +                unset x
8240 +                echo f3: $x
8241 +                x=fb
8242 +                echo f4: $x
8243 +        }
8244 +        x=o
8245 +        echo before: $x
8246 +        f
8247 +        echo after: $x
8248 + expected-stdout:
8249 +        before: o
8250 +        f0: o
8251 +        f1:
8252 +        f2: fa
8253 +        f3: o
8254 +        f4: fb
8255 +        after: fb
8256 + ---
8257   name: varexpand-substr-1
8258   description:
8259          Check if bash-style substring expansion works
# Line 8172 | Line 8413 | name: varexpand-null-1
8413   description:
8414          Ensure empty strings expand emptily
8415   stdin:
8416 <        print x ${a} ${b} y
8417 <        print z ${a#?} ${b%?} w
8418 <        print v ${a=} ${b/c/d} u
8416 >        print s ${a} . ${b} S
8417 >        print t ${a#?} . ${b%?} T
8418 >        print r ${a=} . ${b/c/d} R
8419 >        print q
8420 >        print s "${a}" . "${b}" S
8421 >        print t "${a#?}" . "${b%?}" T
8422 >        print r "${a=}" . "${b/c/d}" R
8423   expected-stdout:
8424 <        x y
8425 <        z w
8426 <        v u
8424 >        s . S
8425 >        t . T
8426 >        r . R
8427 >        q
8428 >        s  .  S
8429 >        t  .  T
8430 >        r  .  R
8431   ---
8432   name: varexpand-null-2
8433   description:
# Line 8194 | Line 8443 | expected-stdout:
8443   name: varexpand-null-3
8444   description:
8445          Ensure concatenating behaviour matches other shells
8197        although the line 2<> is probably wrong? XNULLSUB case.
8446   stdin:
8447 <        x=; printf "1<%s>\n" "$x$@"
8448 <        set A; printf "2<%s>\n" "${@:+}"
8447 >        showargs() { for s_arg in "$@"; do echo -n "<$s_arg> "; done; echo .; }
8448 >        x=; showargs 1 "$x"$@
8449 >        set A; showargs 2 "${@:+}"
8450 >        n() { echo "$#"; }
8451 >        unset e
8452 >        set -- a b
8453 >        n """$@"
8454 >        n "$@"
8455 >        n "$@"""
8456 >        n "$e""$@"
8457 >        n "$@"
8458 >        n "$@""$e"
8459 >        set --
8460 >        n """$@"
8461 >        n "$@"
8462 >        n "$@"""
8463 >        n "$e""$@"
8464 >        n "$@"
8465 >        n "$@""$e"
8466   expected-stdout:
8467 <        1<>
8468 <        2<>
8467 >        <1> <> .
8468 >        <2> <> .
8469 >        2
8470 >        2
8471 >        2
8472 >        2
8473 >        2
8474 >        2
8475 >        1
8476 >        0
8477 >        1
8478 >        1
8479 >        0
8480 >        1
8481   ---
8482   name: print-funny-chars
8483   description:
# Line 10921 | Line 11198 | stdin:
11198          (mypid=$$; try mypid)
11199          echo =15
11200          ) 2>&1 | sed -e 's/^[^]]*]//' -e 's/^[^:]*: *//'
11201 +        exit ${PIPESTATUS[0]}
11202   expected-stdout:
11203          y
11204          =1
# Line 11654 | Line 11932 | expected-stdout:
11932          =GNU bash, version 2.05b.0(1)-release (i386-ecce-mirbsd10)=
11933   expected-stderr-pattern:
11934          /.*/
11935 + ---
11936 + name: xtrace-2
11937 + description:
11938 +        Check that "set -x" is off during PS4 expansion
11939 + stdin:
11940 +        f() {
11941 +                print -n "(f1:$-)"
11942 +                set -x
11943 +                print -n "(f2:$-)"
11944 +        }
11945 +        PS4='[(p:$-)$(f)] '
11946 +        print "(o0:$-)"
11947 +        set -x -o inherit-xtrace
11948 +        print "(o1:$-)"
11949 +        set +x
11950 +        print "(o2:$-)"
11951 + expected-stdout:
11952 +        (o0:sh)
11953 +        (o1:shx)
11954 +        (o2:sh)
11955 + expected-stderr:
11956 +        [(p:sh)(f1:sh)(f2:sh)] print '(o1:shx)'
11957 +        [(p:sh)(f1:sh)(f2:sh)] set +x
11958   ---

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines