From fec4fd0e220399ad6c3844c6f7ea784cc42a20d2 Mon Sep 17 00:00:00 2001 From: augustin64 Date: Tue, 28 Nov 2023 09:59:58 +0100 Subject: [PATCH] Add tests --- tests/main.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 tests/main.sh diff --git a/tests/main.sh b/tests/main.sh new file mode 100755 index 0000000..a25d975 --- /dev/null +++ b/tests/main.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +TMPDIR=$(mktemp -d) + +#! On ne teste pas que l'on peut bien récupérer ces chemins automatiquement, +#! ce qui peut-être une source d'erreurs +export TAKL_DB="$TMPDIR/takl.sqlite3" +export TAKL_SOCKET="$TMPDIR/takl.socket" +echo "Using $TMPDIR" + +make -j + +# Catégories +./takl add "nocategory" +./takl add "category1:test1" + +# Dates +./takl add "date:avec date" min+5 +./takl add "date:avec date2" h+5 +./takl add "date:avec date3" j+5 +./takl add "date:avec date4" "31/12" + +TASK_ID=$(./takl add "done soon" | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | awk '-F[' '{ print $2 }' | awk '-F]' '{ print $1 }') + +# List +./takl list +./takl list date + +# Reschedule +./takl reschedule $TASK_ID "22/11" + +# Get info +./takl info $TASK_ID + +# Mark as done +./takl done $TASK_ID +./takl list -a + +./takl rm $TASK_ID + +#* À rajouter: tests sur le fait que les changements ont bien eu lieu +rm $TMPDIR -r \ No newline at end of file