Compare commits

...

2 Commits
v1.3.4 ... main

Author SHA1 Message Date
6ebadf1d23 Add a config.h parameter for base TMPDIR 2023-11-28 10:00:29 +01:00
fec4fd0e22 Add tests 2023-11-28 09:59:58 +01:00
3 changed files with 49 additions and 2 deletions

View File

@ -1,9 +1,11 @@
#ifndef DEF_CONFIG_H
#define DEF_CONFIG_H
#define VERSION "1.3.4"
#define VERSION "1.3.5"
#define MAX_TASK_ID 10000 // max is set to MAX_TASK_ID-1
#define NEW_TASK_ID_MAX_RETRIES 10000 // number of retries before giving up
#define TMPDIR "/tmp" // Some Unix systems don't use /tmp as tmp dir (eg Android)
#endif

View File

@ -19,9 +19,12 @@ char* get_socket_path() {
return socket_path;
} else {
char* base_path = "/tmp/takl";
char* base_path = TMPDIR "/takl";
char* username = getenv("USER");
if (!username)
username = getenv("USERNAME");
assert(username != NULL);
char* socket_path = malloc(sizeof(char)*(strlen(base_path)+strlen(username)+1));

42
tests/main.sh Executable file
View File

@ -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