"Fossies" - the Fresh Open Source Software Archive

Member "cook-2.34/test/00/t0038a.sh" (25 Sep 2010, 3143 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) 1990-1994, 1997, 1998, 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 #
   20 tmp=${COOK_TMP:-/tmp}/$$
   21 PAGER=cat
   22 export PAGER
   23 umask 022
   24 unset COOK
   25 here=`pwd`
   26 if test $? -ne 0 ; then exit 1; fi
   27 
   28 bin="$here/${1-.}/bin"
   29 
   30 fail()
   31 {
   32         echo 'FAILED test of roffpp command' 1>&2
   33         cd $here
   34         rm -rf $tmp
   35         exit 1
   36 }
   37 pass()
   38 {
   39         cd $here
   40         rm -rf $tmp
   41         exit 0
   42 }
   43 trap "fail" 1 2 3 15
   44 
   45 mkdir $tmp $tmp/lib $tmp/bloggs
   46 cd $tmp
   47 
   48 #
   49 # Use the default error messages.  There is no other way to get
   50 # predictable test behaviour on the unknown systems we will be tested on.
   51 #
   52 COOK_MESSAGE_LIBRARY=$work/no-such-dir
   53 export COOK_MESSAGE_LIBRARY
   54 unset LANG
   55 
   56 #
   57 # test the plain-vanilla form
   58 #
   59 cat > test.in << 'foobar'
   60 testing
   61 .so test2.in
   62 line three
   63 foobar
   64 if test $? -ne 0 ; then fail; fi
   65 
   66 cat > test2.in << 'foobar'
   67 one
   68 two
   69 three
   70 foobar
   71 if test $? -ne 0 ; then fail; fi
   72 
   73 cat > test.ok << 'foobar'
   74 .lf 1 test.in
   75 testing
   76 .lf 1 test2.in
   77 one
   78 two
   79 three
   80 .lf 3 test.in
   81 line three
   82 foobar
   83 if test $? -ne 0 ; then fail; fi
   84 
   85 $bin/roffpp test.in test.out
   86 if test $? -ne 0 ; then fail; fi
   87 
   88 diff test.ok test.out
   89 if test $? -ne 0 ; then fail; fi
   90 
   91 #
   92 # test the .lf directive
   93 #
   94 cat > test.in << 'foobar'
   95 testing
   96 .lf 47 granny-smith
   97 Granny Smith
   98 .so test2.in
   99 line three
  100 foobar
  101 if test $? -ne 0 ; then fail; fi
  102 
  103 cat > test2.in << 'foobar'
  104 one
  105 two
  106 three
  107 foobar
  108 if test $? -ne 0 ; then fail; fi
  109 
  110 cat > test.ok << 'foobar'
  111 .lf 1 test.in
  112 testing
  113 .lf 47 granny-smith
  114 Granny Smith
  115 .lf 1 test2.in
  116 one
  117 two
  118 three
  119 .lf 49 granny-smith
  120 line three
  121 foobar
  122 if test $? -ne 0 ; then fail; fi
  123 
  124 $bin/roffpp test.in test.out
  125 if test $? -ne 0 ; then fail; fi
  126 
  127 diff test.ok test.out
  128 if test $? -ne 0 ; then fail; fi
  129 
  130 #
  131 # test the explicit include path form
  132 #
  133 cat > test.in << 'foobar'
  134 testing
  135 .so test2.in
  136 .so ../test2.in
  137 line four
  138 foobar
  139 if test $? -ne 0 ; then fail; fi
  140 
  141 cat > bloggs/test2.in << 'foobar'
  142 Bodgie Rent-a-Wreck
  143 -- free --
  144 with every 200 lb rotweiler sold
  145 foobar
  146 if test $? -ne 0 ; then fail; fi
  147 
  148 cat > test.ok << 'foobar'
  149 .lf 1 test.in
  150 testing
  151 .lf 1 bloggs/test2.in
  152 Bodgie Rent-a-Wreck
  153 -- free --
  154 with every 200 lb rotweiler sold
  155 .lf 3 test.in
  156 .lf 1 bloggs/../test2.in
  157 one
  158 two
  159 three
  160 .lf 4 test.in
  161 line four
  162 foobar
  163 if test $? -ne 0 ; then fail; fi
  164 
  165 $bin/roffpp -Ibloggs -I. test.in test.out
  166 if test $? -ne 0 ; then fail; fi
  167 
  168 diff test.ok test.out
  169 if test $? -ne 0 ; then fail; fi
  170 
  171 # probably OK
  172 pass