mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-05 23:18:08 +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 SUCCEDED=0
|
||||
declare -i TODTODO=0
|
||||
declare -i RAN=0
|
||||
NAME=""
|
||||
|
||||
failed_report()
|
||||
report_header()
|
||||
{
|
||||
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||
echo $NAME
|
||||
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++"
|
||||
echo "++++ Failed test:"
|
||||
echo "++++ test input:"
|
||||
}
|
||||
|
||||
failed_report()
|
||||
{
|
||||
NAME="failed: $NAME"
|
||||
report_header
|
||||
cat /tmp/input.minishell
|
||||
echo "++++ Got output:"
|
||||
cat /tmp/got.minishell
|
||||
|
|
@ -22,14 +29,28 @@ failed_report()
|
|||
echo "(red is got, green is expected)"
|
||||
diff --color=always /tmp/got.minishell /tmp/expected.minishell
|
||||
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_report >> report.txt
|
||||
echo -n "F"
|
||||
FAILED+=1
|
||||
failed_report >> report.txt
|
||||
}
|
||||
|
||||
succeded()
|
||||
|
|
@ -57,6 +78,13 @@ expecting()
|
|||
assert
|
||||
}
|
||||
|
||||
todo()
|
||||
{
|
||||
echo -n "t"
|
||||
TODO+=1
|
||||
todo_report >> report.txt
|
||||
}
|
||||
|
||||
setup()
|
||||
{
|
||||
rm -f report.txt
|
||||
|
|
@ -65,13 +93,13 @@ setup()
|
|||
finalize()
|
||||
{
|
||||
echo
|
||||
echo "$RAN tests ran. $SUCCEDED succeded, $FAILED failed."
|
||||
echo "$RAN tests ran. $SUCCEDED succeded, $FAILED failed, $TODO todo."
|
||||
if [ $SUCCEDED -eq $RAN ];
|
||||
then
|
||||
echo "All integration tests passed!"
|
||||
else
|
||||
echo "cat report.txt"
|
||||
echo "to see details of failed tests"
|
||||
echo "to see details of failed/todo tests"
|
||||
fi
|
||||
exit $FAILED
|
||||
}
|
||||
|
|
@ -263,4 +291,9 @@ expecting <<EOF
|
|||
╰─ (no redirections)
|
||||
EOF
|
||||
|
||||
when_run <<EOF "quoted parentheses are not operators"
|
||||
echo unclosed '('
|
||||
EOF
|
||||
todo
|
||||
|
||||
finalize
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue