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/&ersand" 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