mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
inttests: add a way to mark a test as TODO
This commit is contained in:
parent
0fbfee7d78
commit
8b67ccc813
1 changed files with 39 additions and 6 deletions
45
test.sh
45
test.sh
|
|
@ -4,15 +4,22 @@ set -uo pipefail
|
||||||
|
|
||||||
declare -i FAILED=0
|
declare -i FAILED=0
|
||||||
declare -i SUCCEDED=0
|
declare -i SUCCEDED=0
|
||||||
|
declare -i TODTODO=0
|
||||||
declare -i RAN=0
|
declare -i RAN=0
|
||||||
NAME=""
|
NAME=""
|
||||||
|
|
||||||
failed_report()
|
report_header()
|
||||||
{
|
{
|
||||||
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||||
echo $NAME
|
echo $NAME
|
||||||
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||||
echo "++++ Failed test:"
|
echo "++++ test input:"
|
||||||
|
}
|
||||||
|
|
||||||
|
failed_report()
|
||||||
|
{
|
||||||
|
NAME="failed: $NAME"
|
||||||
|
report_header
|
||||||
cat /tmp/input.minishell
|
cat /tmp/input.minishell
|
||||||
echo "++++ Got output:"
|
echo "++++ Got output:"
|
||||||
cat /tmp/got.minishell
|
cat /tmp/got.minishell
|
||||||
|
|
@ -22,14 +29,28 @@ failed_report()
|
||||||
echo "(red is got, green is expected)"
|
echo "(red is got, green is expected)"
|
||||||
diff --color=always /tmp/got.minishell /tmp/expected.minishell
|
diff --color=always /tmp/got.minishell /tmp/expected.minishell
|
||||||
echo "++++ Run this to debug:"
|
echo "++++ Run this to debug:"
|
||||||
echo "echo '$(cat /tmp/input.minishell)' | ./minishell"
|
cat < /tmp/input.minishell > /tmp/input.failed.$FAILED.minishell
|
||||||
|
echo "cat /tmp/input.failed.$FAILED.minishell | ./minishell"
|
||||||
|
}
|
||||||
|
|
||||||
|
todo_report()
|
||||||
|
{
|
||||||
|
NAME="todo: $NAME"
|
||||||
|
report_header
|
||||||
|
cat /tmp/input.minishell
|
||||||
|
echo "++++ Got output:"
|
||||||
|
cat /tmp/got.minishell
|
||||||
|
echo "++++ But test was marked as todo."
|
||||||
|
echo "++++ Run this to debug:"
|
||||||
|
cat < /tmp/input.minishell > /tmp/input.todo.$TODO.minishell
|
||||||
|
echo "cat /tmp/input.todo.$TODO.minishell | ./minishell"
|
||||||
}
|
}
|
||||||
|
|
||||||
failed()
|
failed()
|
||||||
{
|
{
|
||||||
failed_report >> report.txt
|
|
||||||
echo -n "F"
|
echo -n "F"
|
||||||
FAILED+=1
|
FAILED+=1
|
||||||
|
failed_report >> report.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
succeded()
|
succeded()
|
||||||
|
|
@ -57,6 +78,13 @@ expecting()
|
||||||
assert
|
assert
|
||||||
}
|
}
|
||||||
|
|
||||||
|
todo()
|
||||||
|
{
|
||||||
|
echo -n "t"
|
||||||
|
TODO+=1
|
||||||
|
todo_report >> report.txt
|
||||||
|
}
|
||||||
|
|
||||||
setup()
|
setup()
|
||||||
{
|
{
|
||||||
rm -f report.txt
|
rm -f report.txt
|
||||||
|
|
@ -65,13 +93,13 @@ setup()
|
||||||
finalize()
|
finalize()
|
||||||
{
|
{
|
||||||
echo
|
echo
|
||||||
echo "$RAN tests ran. $SUCCEDED succeded, $FAILED failed."
|
echo "$RAN tests ran. $SUCCEDED succeded, $FAILED failed, $TODO todo."
|
||||||
if [ $SUCCEDED -eq $RAN ];
|
if [ $SUCCEDED -eq $RAN ];
|
||||||
then
|
then
|
||||||
echo "All integration tests passed!"
|
echo "All integration tests passed!"
|
||||||
else
|
else
|
||||||
echo "cat report.txt"
|
echo "cat report.txt"
|
||||||
echo "to see details of failed tests"
|
echo "to see details of failed/todo tests"
|
||||||
fi
|
fi
|
||||||
exit $FAILED
|
exit $FAILED
|
||||||
}
|
}
|
||||||
|
|
@ -263,4 +291,9 @@ expecting <<EOF
|
||||||
╰─ (no redirections)
|
╰─ (no redirections)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
when_run <<EOF "quoted parentheses are not operators"
|
||||||
|
echo unclosed '('
|
||||||
|
EOF
|
||||||
|
todo
|
||||||
|
|
||||||
finalize
|
finalize
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue