"Fossies" - the Fresh Open Source Software Archive

Member "detox-1.4.5/tests/tests/github-issue-0056/test.sh" (15 Aug 2021, 1066 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 #56 is resolved
    4 #
    5 # https://github.com/dharple/detox/issues/56
    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 BASE=/tmp/detoxtest/
   20 if [ ! -d $BASE ] ; then
   21     mkdir $BASE
   22 fi
   23 
   24 # ------------------------------------------------------------------------
   25 
   26 WORK=$(realpath $(mktemp -d $BASE/test-custom-XXXXXX))
   27 cd $WORK
   28 
   29 VALGRIND=$(command -v valgrind || true)
   30 
   31 touch a b c d e f g h i j k
   32 
   33 if [ -z "$VALGRIND" ] ; then
   34     echo WARNING: valgrind is not installed
   35 else
   36     $VALGRIND --quiet --error-exitcode=1 --track-origins=yes $DETOX a b c d e f g h i j k
   37 fi
   38 
   39 # ------------------------------------------------------------------------
   40 
   41 INPUT="has space"
   42 OUTPUT="has_space"
   43 
   44 for COUNT in 10 100 1000 ; do
   45     WORK=$(realpath $(mktemp -d $BASE/test-custom-XXXXXX))
   46     cd $WORK
   47 
   48     touch $(seq 1 $COUNT) "$INPUT"
   49     $DETOX $(seq 1 $COUNT) "$INPUT"
   50 
   51     if [ ! -f "$OUTPUT" ] ; then
   52         echo "Could not find expected file '$OUTPUT'"
   53         exit 1
   54     fi
   55 done