diff --git a/init.sh b/init.sh index 98a011b..7e098e7 100755 --- a/init.sh +++ b/init.sh @@ -52,6 +52,7 @@ git remote remove origin # remove this script from the project (but keep on disk for now) git rm --cached init.sh +git rm -r skel-test # escape HTML special characters (&, <, and >), but also sed special characters (& again, \, and /) htmlname=$(echo -n "$name" | sed 's/&/\&/g; s//\>/g; s:[\\/&]:\\&:g') diff --git a/skel-test/README.md b/skel-test/README.md new file mode 100644 index 0000000..c0d80e5 --- /dev/null +++ b/skel-test/README.md @@ -0,0 +1,3 @@ +# Self-tests + +This directory contains self-tests for the skeleton itself. It should be removed when starting a new project. diff --git a/skel-test/cargo.sh b/skel-test/cargo.sh new file mode 100755 index 0000000..4c0e2cc --- /dev/null +++ b/skel-test/cargo.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -E + +exec cargo check diff --git a/skel-test/cmake.sh b/skel-test/cmake.sh new file mode 100755 index 0000000..6d2b548 --- /dev/null +++ b/skel-test/cmake.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +set -x +set -E + +mkdir build +cmake -S . -B build -G Ninja -D CMAKE_BUILD_TYPE=Debug +ninja -C build diff --git a/skel-test/test-nogit.sh b/skel-test/test-nogit.sh new file mode 100755 index 0000000..1aa4a74 --- /dev/null +++ b/skel-test/test-nogit.sh @@ -0,0 +1,17 @@ +#!/bin/zsh + +set -e +trap 'echo Test failed!' ERR +name=' "Example"' +dir=${0%/*} +root=$dir/.. +tmp=$(mktemp -d) +trap 'rm -rf $tmp' EXIT +rsync -a --exclude=/.git --exclude-from=$root/.gitignore $root/. $tmp/ +cd $tmp +echo "Initializing in $tmp" +./init.sh $name +echo "Starting the shell in $tmp" +echo "Review the files, then exit the shell" +${SHELL:-/bin/sh} -i +echo "Review successful, cleaning up" diff --git a/skel-test/test-tar.sh b/skel-test/test-tar.sh new file mode 100755 index 0000000..8c60732 --- /dev/null +++ b/skel-test/test-tar.sh @@ -0,0 +1,16 @@ +#!/bin/zsh + +set -e +trap 'echo Test failed!' ERR +name=' "Example"' +root=$(realpath ${0%/*}/..) +tmp=$(mktemp -d) +trap 'rm -rf $tmp' EXIT +cd $tmp +git -C $root archive HEAD | tar -x +echo "Initializing in $tmp" +./init.sh $name +echo "Starting the shell in $tmp" +echo "Review the files, then exit the shell" +${SHELL:-/bin/sh} -i +echo "Review successful, cleaning up" diff --git a/skel-test/test.sh b/skel-test/test.sh new file mode 100755 index 0000000..f80950f --- /dev/null +++ b/skel-test/test.sh @@ -0,0 +1,18 @@ +#!/bin/zsh + +set -e +trap 'echo Test failed!' ERR +name=' "Example"' +dir=${0%/*} +root=$dir/.. +tmp=$(mktemp -d) +trap 'rm -rf $tmp' EXIT +rsync -a --exclude-from=$root/.gitignore $root/. $tmp/ +cd $tmp +git clean -fxdq +echo "Initializing in $tmp" +./init.sh $name +echo "Starting the shell in $tmp" +echo "Review the files, then exit the shell" +${SHELL:-/bin/sh} -i +echo "Review successful, cleaning up"