From fa402bd42d648e8862c5379f66837d5cb8664e89 Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Sun, 28 Feb 2016 18:54:18 +0000 Subject: [PATCH] doesn't quite work --- tests/Single-file test suites/setup_dir | 12 +++++++++++- tests/Single-file test suites/teardown_dir | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/Single-file test suites/setup_dir b/tests/Single-file test suites/setup_dir index e1951ca..08a9174 100644 --- a/tests/Single-file test suites/setup_dir +++ b/tests/Single-file test suites/setup_dir @@ -1,12 +1,22 @@ n=0 +tmp=$(mktemp -d) +testdir=$tmp/tests while read line; do n=$(($n + 1)) contents=$(echo "$line" | cut -d, -f1) expectation=$(echo "$line" | cut -d, -f2) + # Set up the test suite. + mkdir -p "$testdir/$n" + touch "$testdir/$n/.urchin" + echo "$contents" > "$testdir/$n/testcase" + + # Write the test that runs on the test suite + echo "#!/bin/sh +../../urchin -t '$testdir/$n' | grep '$expectation'" > $n + # Skip if invalid. - echo "$contents" > "$n" if test "$expectation" = ok || test "$expectation" = not\ ok || test "$expectation" = skip; then chmod +x $n diff --git a/tests/Single-file test suites/teardown_dir b/tests/Single-file test suites/teardown_dir index 145e62c..eddc331 100644 --- a/tests/Single-file test suites/teardown_dir +++ b/tests/Single-file test suites/teardown_dir @@ -1,3 +1,4 @@ +rm -R "$tmp" if ls | grep '^[0-9]' > /dev/null; then rm [0-9]* fi