Add self-tests #1
1
init.sh
1
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; s:[\\/&]:\\&:g')
|
||||
|
|
|
|||
3
skel-test/README.md
Normal file
3
skel-test/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Self-tests
|
||||
|
||||
This directory contains self-tests for the skeleton itself. It should be removed when starting a new project.
|
||||
5
skel-test/cargo.sh
Executable file
5
skel-test/cargo.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -E
|
||||
|
||||
exec cargo check
|
||||
8
skel-test/cmake.sh
Executable file
8
skel-test/cmake.sh
Executable file
|
|
@ -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
|
||||
17
skel-test/test-nogit.sh
Executable file
17
skel-test/test-nogit.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/zsh
|
||||
|
||||
set -e
|
||||
trap 'echo Test failed!' ERR
|
||||
name='<Test/+> "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"
|
||||
16
skel-test/test-tar.sh
Executable file
16
skel-test/test-tar.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/zsh
|
||||
|
||||
set -e
|
||||
trap 'echo Test failed!' ERR
|
||||
name='<Test/+> "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"
|
||||
18
skel-test/test.sh
Executable file
18
skel-test/test.sh
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/zsh
|
||||
|
||||
set -e
|
||||
trap 'echo Test failed!' ERR
|
||||
name='<Test/+> "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"
|
||||
Loading…
Reference in New Issue
Block a user