"Fossies" - the Fresh Open Source Software Archive

Member "detox-1.4.5/tests/tests/github-issue-0012/test.sh" (15 Aug 2021, 1388 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 # Tests to confirm GitHub issue #12 is resolved
    4 #
    5 # https://github.com/dharple/detox/issues/12
    6 #
    7 
    8 set -e
    9 
   10 if [ -z "$TESTBASE" ] ; then
   11     echo TESTBASE needs to be passed via the env
   12     exit 1
   13 fi
   14 
   15 . $TESTBASE/test-functions
   16 
   17 DETOX=$1
   18 
   19 CONFIGPATH=$(dirname $TESTBASE)/etc
   20 
   21 BASE=/tmp/detoxtest/
   22 if [ ! -d $BASE ] ; then
   23     mkdir $BASE
   24 fi
   25 WORK=$(realpath $(mktemp -d $BASE/test-custom-XXXXXX))
   26 
   27 # -----
   28 
   29 cd $WORK
   30 touch "hi there" "another test" "wow"
   31 EXPECTED="hi_there another_test wow"
   32 
   33 $DETOX -r .
   34 
   35 for OUTPUT in $EXPECTED ; do
   36     if [ ! -f "$OUTPUT" ] ; then
   37         echo expected "$OUTPUT" not found
   38         exit 1
   39     fi
   40 done
   41 
   42 # -----
   43 
   44 cd $WORK
   45 touch "hi there2" "another test2" "wow2"
   46 EXPECTED="hi_there2 another_test2 wow2"
   47 
   48 cd $TESTBASE
   49 $DETOX -r $WORK
   50 cd $WORK
   51 
   52 for OUTPUT in $EXPECTED ; do
   53     if [ ! -f "$OUTPUT" ] ; then
   54         echo expected "$OUTPUT" not found
   55         exit 1
   56     fi
   57 done
   58 
   59 # -----
   60 
   61 cd $WORK
   62 mkdir 3 confirm.3
   63 cd 3
   64 touch "hi there3" "another test3" "wow3"
   65 EXPECTED="hi_there3 another_test3 wow3"
   66 
   67 cd $TESTBASE
   68 $DETOX -r $WORK/confirm.3/..
   69 cd $WORK/3
   70 
   71 for OUTPUT in $EXPECTED ; do
   72     if [ ! -f "$OUTPUT" ] ; then
   73         echo expected "$OUTPUT" not found
   74         exit 1
   75     fi
   76 done
   77 
   78 # -----
   79 
   80 INPUT="4/.gnome/ignore me"
   81 OUTPUT="$INPUT"
   82 
   83 cd $WORK
   84 mkdir -p 4/.gnome
   85 touch "$INPUT"
   86 
   87 $DETOX -f $CONFIGPATH/detoxrc.sample -r 4/
   88 
   89 if [ ! -f "$OUTPUT" ] ; then
   90     echo expected "$OUTPUT" not found
   91     exit 1
   92 fi