"Fossies" - the Fresh Open Source Software Archive

Member "cook-2.34/test/01/t0196a.sh" (25 Sep 2010, 1665 Bytes) of package /linux/misc/old/cook-2.34.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 #
    3 #       cook - file construction tool
    4 #       Copyright (C) 2000, 2007, 2008 Peter Miller
    5 #
    6 #       This program is free software; you can redistribute it and/or modify
    7 #       it under the terms of the GNU General Public License as published by
    8 #       the Free Software Foundation; either version 3 of the License, or
    9 #       (at your option) any later version.
   10 #
   11 #       This program is distributed in the hope that it will be useful,
   12 #       but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 #       GNU General Public License for more details.
   15 #
   16 #       You should have received a copy of the GNU General Public License
   17 #       along with this program. If not, see
   18 #       <http://www.gnu.org/licenses/>.
   19 # they may match the empty string, so long as it's not at the start
   20 #
   21 tmp=${COOK_TMP:-/tmp}/$$
   22 PAGER=cat
   23 export PAGER
   24 umask 022
   25 unset COOK
   26 here=`pwd`
   27 if test $? -ne 0 ; then exit 1; fi
   28 
   29 bin="$here/${1-.}/bin"
   30 
   31 fail()
   32 {
   33         echo 'FAILED test of "%n" patterns' 1>&2
   34         cd $here
   35         rm -rf $tmp
   36         exit 1
   37 }
   38 pass()
   39 {
   40         cd $here
   41         rm -rf $tmp
   42         exit 0
   43 }
   44 trap "fail" 1 2 3 15
   45 
   46 mkdir $tmp $tmp/lib
   47 cd $tmp
   48 
   49 #
   50 # Use the default error messages.  There is no other way to get
   51 # predictable test behaviour on the unknown systems we will be tested on.
   52 #
   53 COOK_MESSAGE_LIBRARY=$work/no-such-dir
   54 export COOK_MESSAGE_LIBRARY
   55 unset LANG
   56 
   57 cat > Howto.cook << 'foobar'
   58 test:
   59 {
   60         if [not [match_mask fu%1/%2 fu/bar]] then fail;
   61 }
   62 foobar
   63 if test $? -ne 0 ; then fail; fi
   64 
   65 $bin/cook -nl
   66 if test $? -ne 0 ; then fail; fi
   67 
   68 # probably OK
   69 pass