init.sh: add tests (for manual running only for now)

This commit is contained in:
numzero 2026-04-03 17:01:12 +03:00
parent ff3ec96819
commit 7baefc958d
5 changed files with 64 additions and 0 deletions

5
test/cargo.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
set -E
exec cargo check

8
test/cmake.sh Executable file
View 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
test/test-nogit.sh Executable file
View 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
test/test-tar.sh Executable file
View 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
test/test.sh Executable file
View 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"