"Fossies" - the Fresh Open Source Software Archive

Member "tcsh-6.22.03/tests/subst.at" (18 Nov 2020, 1817 Bytes) of package /linux/misc/tcsh-6.22.03.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "subst.at": 6.22.02_vs_6.22.03.

    1 # Optional substitutions
    2 
    3 AT_SETUP([Command substitution])
    4 
    5 AT_DATA([backq.csh],
    6 [[set a=(a`echo 1 2; echo 3 4`b)
    7 echo $#a
    8 set a=(a"`echo 1 2; echo 3 4`b")
    9 echo $#a
   10 unset csubstnonl
   11 echo `echo 1; \\
   12 echo 2`
   13 set csubstnonl
   14 echo `echo 1; \\
   15   echo 2`
   16 ]])
   17 AT_CHECK([tcsh -f backq.csh], 1,
   18 [4
   19 2
   20 1 2
   21 1
   22 ],
   23 [ : Command not found.
   24 ])
   25 
   26 AT_CLEANUP
   27 
   28 
   29 AT_SETUP([Filename substitution])
   30 
   31 AT_DATA([files.csh],
   32 [[mkdir d
   33 cd d
   34 touch foo baz bar .quux '*'
   35 echo *a* *[ox] [f.]* .q* ./*[ox] ./[f.]* ./.q* \*
   36 echo [a-g]* [^b]* ^b?r
   37 echo { ba{z,r} } {}
   38 echo nothing* fo*
   39 set nonomatch
   40 echo nothing*
   41 set noglob
   42 echo foo* ab{c,d} ^fo*
   43 ]])
   44 AT_CHECK([tcsh -f files.csh], ,
   45 [bar baz foo foo .quux ./foo ./foo ./.quux *
   46 bar baz foo * foo * baz foo
   47 { baz bar } {}
   48 foo
   49 nothing*
   50 foo* ab{c,d} ^fo*
   51 ])
   52 
   53 AT_CHECK([
   54 case "$(uname -s)" in
   55 Darwin)
   56     HOME=$(dscl . read "/Users/$USER" NFSHomeDirectory | awk '{ print $NF }')
   57     ;;
   58 *)
   59     HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
   60     ;;
   61 esac;
   62 export HOME;
   63 echo 'echo ~; echo "$HOME"' | tcsh -f | uniq | wc -l | tr -d ' \t'
   64 ],
   65 , [1
   66 ])
   67 
   68 AT_CHECK([
   69 case "$(uname -s)" in
   70 Darwin)
   71     HOME=$(dscl . read "/Users/$USER" NFSHomeDirectory | awk '{ print $NF }')
   72     ;;
   73 *)
   74     HOME=$(getent passwd $(id -un) | awk -F: '{ print $(NF - 1) }')
   75     ;;
   76 esac;
   77 export HOME;
   78 echo "echo ~$(id -un)/foo; echo \"\$HOME/foo\"" | tcsh -f | uniq dnl
   79     | wc -l | tr -d ' \t'
   80 ], , [1
   81 ])
   82 
   83 AT_CLEANUP
   84 
   85 
   86 AT_SETUP([Directory stack substitution])
   87 
   88 AT_DATA([dirstack.csh],
   89 [[set home=$cwd
   90 pushd /
   91 pushd /dev
   92 echo =0/:foo
   93 echo =1/:foo
   94 echo =-
   95 set noglob
   96 echo =1
   97 unset noglob
   98 sh -c 'echo 1 >&2'
   99 (echo =5)
  100 sh -c 'echo 2 >&2'
  101 set nonomatch
  102 echo =5
  103 ]])
  104 AT_CHECK([tcsh -f dirstack.csh | sed "s,$PWD,CWD,"], ,
  105 [/ ~ @&t@
  106 /dev / ~ @&t@
  107 /dev/:foo
  108 //:foo
  109 CWD
  110 =1
  111 =5
  112 ],
  113 [1
  114 Directory stack not that deep.
  115 2
  116 ])
  117 
  118 AT_CLEANUP