#!/bin/sh # Simple test suite set -e tmp="tests" mkdir -p "$tmp" trap 'rm -rf "$tmp"' EXIT testdirs="1.testdir 2.testdir 3.testdir 4.testdir" testfiles="1.testfile 2.testfile 3.testfile" for d in $testdirs; do mkdir -p "$tmp/$d" for f in $testfiles; do touch "$tmp/$d/$f"; done done ./trash -v "$tmp/1.testdir/1.testfile" "$tmp/1.testdir/2.testfile" "$tmp/2.testdir" "$tmp/3.testdir" ./trash -vfu 1.testfile ./trash -vfu 2.testdir [ -e "$tmp/1.testdir/1.testfile" ] ! [ -e "$tmp/1.testdir/2.testfile" ] [ -e "$tmp/1.testdir/3.testfile" ] [ -e "$tmp/2.testdir" ] [ -e "$tmp/2.testdir/1.testfile" ] ! [ -e "$tmp/3.testdir" ] [ -e "$tmp/4.testdir" ] echo "Tests passed!"