"Fossies" - the Fresh Open Source Software Archive

Member "detox-1.4.5/tests/tests/legacy-dir/test.sh" (15 Aug 2021, 891 Bytes) of package /linux/privat/detox-1.4.5.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 and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "test.sh": 1.4.2_vs_1.4.3.

    1 #!/usr/bin/env bash
    2 #
    3 # Subset of legacy regression tests: recursion
    4 #
    5 
    6 set -e
    7 
    8 if [ -z "$TESTBASE" ] ; then
    9     echo TESTBASE needs to be passed via the env
   10     exit 1
   11 fi
   12 
   13 . $TESTBASE/test-functions
   14 
   15 DETOX=$1
   16 
   17 BASE=/tmp/detoxtest/
   18 if [ ! -d $BASE ] ; then
   19     mkdir $BASE
   20 fi
   21 WORK=$(realpath $(mktemp -d $BASE/test-custom-XXXXXX))
   22 
   23 # -----
   24 
   25 cd $WORK
   26 
   27 mkdir 1 2 3 4 5
   28 
   29 INPUT="1/&ampersand"
   30 touch "$INPUT"
   31 
   32 INPUT="2/|bar"
   33 touch "$INPUT"
   34 
   35 INPUT="3/:colon"
   36 touch "$INPUT"
   37 
   38 INPUT="4/,comma"
   39 touch "$INPUT"
   40 
   41 INPUT="5/#octothorpe"
   42 touch "$INPUT"
   43 
   44 INPUT="%percent"
   45 touch "$INPUT"
   46 
   47 INPUT="+plus"
   48 touch "$INPUT"
   49 
   50 INPUT=";semi colon"
   51 touch "$INPUT"
   52 
   53 # -----
   54 
   55 cd $TESTBASE
   56 $DETOX -r $WORK
   57 cd $WORK
   58 
   59 # -----
   60 
   61 EXPECTED="1/and_ampersand 2/bar 3/colon 4/,comma 5/octothorpe %percent +plus semi_colon"
   62 
   63 for OUTPUT in $EXPECTED ; do
   64     if [ ! -f "$OUTPUT" ] ; then
   65         echo expected "$OUTPUT" not found
   66         exit 1
   67     fi
   68 done
   69