From 4a2f5e2183c42562bf5f766c6ed01da3880dc10c Mon Sep 17 00:00:00 2001 From: Nitroretro Date: Sat, 21 Dec 2019 04:16:40 +0200 Subject: Test for the directory structure Ensure that calcurse uses the right data and configuration directories depending on the conditions. Helped-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- test/Makefile.am | 6 ++++++ test/io-001.sh | 10 ++++++++++ test/io-002.sh | 11 +++++++++++ test/io-003.sh | 12 ++++++++++++ test/io-004.sh | 12 ++++++++++++ test/io-005.sh | 11 +++++++++++ test/io-006.sh | 12 ++++++++++++ 7 files changed, 74 insertions(+) create mode 100755 test/io-001.sh create mode 100755 test/io-002.sh create mode 100755 test/io-003.sh create mode 100755 test/io-004.sh create mode 100755 test/io-005.sh create mode 100755 test/io-006.sh diff --git a/test/Makefile.am b/test/Makefile.am index 4561a30..d896dc3 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,6 +4,12 @@ TESTS = \ true-001.sh \ run-test-001.sh \ run-test-002.sh \ + io-001.sh \ + io-002.sh \ + io-003.sh \ + io-004.sh \ + io-005.sh \ + io-006.sh \ todo-001.sh \ todo-002.sh \ todo-003.sh \ diff --git a/test/io-001.sh b/test/io-001.sh new file mode 100755 index 0000000..77757f6 --- /dev/null +++ b/test/io-001.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +. "${TEST_INIT:-./test-init.sh}" +data=$(mktemp -d) + +"$CALCURSE" -a -D "$data" +[ -f "$data/apts" ] && [ -f "$data/conf" ] && failed=0 || failed=1 + +rm -rf "$data" +exit "$failed" diff --git a/test/io-002.sh b/test/io-002.sh new file mode 100755 index 0000000..fadd222 --- /dev/null +++ b/test/io-002.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. "${TEST_INIT:-./test-init.sh}" +data=$(mktemp -d) +conf=$(mktemp -d) + +"$CALCURSE" -a -D "$data" -C "$conf" +[ -f "$data/apts" ] && [ -f "$conf/conf" ] && failed=0 || failed=1 + +rm -rf "$data" "$conf" +exit "$failed" diff --git a/test/io-003.sh b/test/io-003.sh new file mode 100755 index 0000000..d52d321 --- /dev/null +++ b/test/io-003.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "${TEST_INIT:-./test-init.sh}" +home=$(mktemp -d) +data="$home/.calcurse" + +mkdir "$data" +HOME="$home" "$CALCURSE" -a +[ -f "$data/apts" ] && [ -f "$data/conf" ] && failed=0 || failed=1 + +rm -rf "$home" +exit "$failed" diff --git a/test/io-004.sh b/test/io-004.sh new file mode 100755 index 0000000..cae71b3 --- /dev/null +++ b/test/io-004.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "${TEST_INIT:-./test-init.sh}" +home=$(mktemp -d) +data=$(mktemp -d) +conf=$(mktemp -d) + +HOME="$home" XDG_DATA_HOME="$data" XDG_CONFIG_HOME="$conf" "$CALCURSE" -a +[ -f "$data/calcurse/apts" ] && [ -f "$conf/calcurse/conf" ] && failed=0 || failed=1 + +rm -rf "$home" "$data" "$conf" +exit "$failed" diff --git a/test/io-005.sh b/test/io-005.sh new file mode 100755 index 0000000..c5ebcc7 --- /dev/null +++ b/test/io-005.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. "${TEST_INIT:-./test-init.sh}" +home=$(mktemp -d) + +CALCURSE=$(readlink -f "$CALCURSE") +(unset -v XDG_DATA_HOME XDG_CONFIG_HOME; HOME="$home" "$CALCURSE" -a) +[ -f "$home/.local/share/calcurse/apts" ] && [ -f "$home/.config/calcurse/conf" ] && failed=0 || failed=1 + +rm -rf "$home" +exit "$failed" diff --git a/test/io-006.sh b/test/io-006.sh new file mode 100755 index 0000000..4184d9f --- /dev/null +++ b/test/io-006.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +. "${TEST_INIT:-./test-init.sh}" +dir=$(mktemp -d) + +CALCURSE=$(readlink -f "$CALCURSE") +cd "$dir" +(unset -v HOME XDG_DATA_HOME XDG_CONFIG_HOME; "$CALCURSE" -a) +[ -f "$dir/.calcurse/apts" ] && [ -f "$dir/.calcurse/conf" ] && failed=0 || failed=1 + +rm -rf "$dir" +exit "$failed" -- cgit v1.2.3-70-g09d2