From a59a9e98951d890e1b830136f7c935b87e00aff3 Mon Sep 17 00:00:00 2001 From: Mark Nevill Date: Sat, 1 May 2010 22:52:46 +0200 Subject: [PATCH] Added lots of tests. --- tests/Makefile.am | 25 +++++++++++++++++++++++++ tests/querycd.1 | 11 +++++++++++ tests/querycd.2 | 11 +++++++++++ tests/querycd.3 | 14 ++++++++++++++ tests/querycd.4 | 15 +++++++++++++++ tests/querycd.5 | 11 +++++++++++ tests/querycs.1 | 14 ++++++++++++++ tests/querycs.2 | 14 ++++++++++++++ tests/querycs.3 | 15 +++++++++++++++ tests/querycs.4 | 15 +++++++++++++++ tests/querycs.5 | 16 ++++++++++++++++ tests/querydd.1 | 13 +++++++++++++ tests/querydd.2 | 11 +++++++++++ tests/querydd.3 | 13 +++++++++++++ tests/querydd.4 | 14 ++++++++++++++ tests/querydd.5 | 11 +++++++++++ tests/querydh.1 | 11 +++++++++++ tests/querydh.2 | 11 +++++++++++ tests/querydh.3 | 11 +++++++++++ tests/queryds.1 | 16 ++++++++++++++++ tests/queryds.2 | 16 ++++++++++++++++ tests/queryds.3 | 17 +++++++++++++++++ tests/queryds.4 | 17 +++++++++++++++++ tests/queryds.5 | 18 ++++++++++++++++++ tests/queryds.6 | 17 +++++++++++++++++ 25 files changed, 357 insertions(+) create mode 100755 tests/querycd.1 create mode 100755 tests/querycd.2 create mode 100755 tests/querycd.3 create mode 100755 tests/querycd.4 create mode 100755 tests/querycd.5 create mode 100755 tests/querycs.1 create mode 100755 tests/querycs.2 create mode 100755 tests/querycs.3 create mode 100755 tests/querycs.4 create mode 100755 tests/querycs.5 create mode 100755 tests/querydd.1 create mode 100755 tests/querydd.2 create mode 100755 tests/querydd.3 create mode 100755 tests/querydd.4 create mode 100755 tests/querydd.5 create mode 100755 tests/querydh.1 create mode 100755 tests/querydh.2 create mode 100755 tests/querydh.3 create mode 100755 tests/queryds.1 create mode 100755 tests/queryds.2 create mode 100755 tests/queryds.3 create mode 100755 tests/queryds.4 create mode 100755 tests/queryds.5 create mode 100755 tests/queryds.6 diff --git a/tests/Makefile.am b/tests/Makefile.am index 7d515f0..0a78ab8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,8 +1,33 @@ AM_CFLAGS = -I$(top_srcdir)/include +AUTOMAKE_OPTIONS = color-tests check_PROGRAMS = testdump testfind testquery QUERYTESTS = \ + querycd.1 \ + querycd.2 \ + querycd.3 \ + querycd.4 \ + querycd.5 \ + querycs.1 \ + querycs.2 \ + querycs.3 \ + querycs.4 \ + querycs.5 \ + querydd.1 \ + querydd.2 \ + querydd.3 \ + querydd.4 \ + querydd.5 \ + querydh.1 \ + querydh.2 \ + querydh.3 \ + queryds.1 \ + queryds.2 \ + queryds.3 \ + queryds.4 \ + queryds.5 \ + queryds.6 \ # TESTS = testdump ${QUERYTESTS} diff --git a/tests/querycd.1 b/tests/querycd.1 new file mode 100755 index 0000000..2a06484 --- /dev/null +++ b/tests/querycd.1 @@ -0,0 +1,11 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_DIRS= + +arguments='config dirs' +expected='/etc/xdg' + +. "$harness" diff --git a/tests/querycd.2 b/tests/querycd.2 new file mode 100755 index 0000000..299d5ce --- /dev/null +++ b/tests/querycd.2 @@ -0,0 +1,11 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_DIRS=/etc/config + +arguments='config dirs' +expected='/etc/config' + +. "$harness" diff --git a/tests/querycd.3 b/tests/querycd.3 new file mode 100755 index 0000000..94c498b --- /dev/null +++ b/tests/querycd.3 @@ -0,0 +1,14 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_DIRS=/etc/config:/etc/xdg:/usr/share/config + +arguments='config dirs' +expected="\ +/etc/config +/etc/xdg +/usr/share/config" + +. "$harness" diff --git a/tests/querycd.4 b/tests/querycd.4 new file mode 100755 index 0000000..4b209a0 --- /dev/null +++ b/tests/querycd.4 @@ -0,0 +1,15 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_DIRS=/etc/config:/etc/xdg:/usr/share/config:. + +arguments='config dirs' +expected="\ +/etc/config +/etc/xdg +/usr/share/config +." + +. "$harness" diff --git a/tests/querycd.5 b/tests/querycd.5 new file mode 100755 index 0000000..f1321f5 --- /dev/null +++ b/tests/querycd.5 @@ -0,0 +1,11 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_DIRS="/path/with a few spaces" + +arguments='config dirs' +expected="/path/with a few spaces" + +. "$harness" diff --git a/tests/querycs.1 b/tests/querycs.1 new file mode 100755 index 0000000..b9a0684 --- /dev/null +++ b/tests/querycs.1 @@ -0,0 +1,14 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_HOME= +export XDG_CONFIG_DIRS= + +arguments='config search' +expected="\ +/home/test/.config +/etc/xdg" + +. "$harness" diff --git a/tests/querycs.2 b/tests/querycs.2 new file mode 100755 index 0000000..1d4ef25 --- /dev/null +++ b/tests/querycs.2 @@ -0,0 +1,14 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_HOME=/home/test/Config +export XDG_CONFIG_DIRS= + +arguments='config search' +expected="\ +/home/test/Config +/etc/xdg" + +. "$harness" diff --git a/tests/querycs.3 b/tests/querycs.3 new file mode 100755 index 0000000..006544e --- /dev/null +++ b/tests/querycs.3 @@ -0,0 +1,15 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_HOME= +export XDG_CONFIG_DIRS=/etc/config:/etc/xdg + +arguments='config search' +expected="\ +/home/test/.config +/etc/config +/etc/xdg" + +. "$harness" diff --git a/tests/querycs.4 b/tests/querycs.4 new file mode 100755 index 0000000..c49332c --- /dev/null +++ b/tests/querycs.4 @@ -0,0 +1,15 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_HOME=/home/test/configuration +export XDG_CONFIG_DIRS=/etc/config:/etc/xdg + +arguments='config search' +expected="\ +/home/test/configuration +/etc/config +/etc/xdg" + +. "$harness" diff --git a/tests/querycs.5 b/tests/querycs.5 new file mode 100755 index 0000000..7919679 --- /dev/null +++ b/tests/querycs.5 @@ -0,0 +1,16 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_CONFIG_HOME=/home/test/configuration +export XDG_CONFIG_DIRS=/etc/config:/etc/xdg:. + +arguments='config search' +expected="\ +/home/test/configuration +/etc/config +/etc/xdg +." + +. "$harness" diff --git a/tests/querydd.1 b/tests/querydd.1 new file mode 100755 index 0000000..7721f9d --- /dev/null +++ b/tests/querydd.1 @@ -0,0 +1,13 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_DIRS= + +arguments='data dirs' +expected="\ +/usr/local/share +/usr/share" + +. "$harness" diff --git a/tests/querydd.2 b/tests/querydd.2 new file mode 100755 index 0000000..b557ca2 --- /dev/null +++ b/tests/querydd.2 @@ -0,0 +1,11 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_DIRS=/etc/data + +arguments='data dirs' +expected="/etc/data" + +. "$harness" diff --git a/tests/querydd.3 b/tests/querydd.3 new file mode 100755 index 0000000..eef9e4d --- /dev/null +++ b/tests/querydd.3 @@ -0,0 +1,13 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_DIRS=/etc/data:/usr/share + +arguments='data dirs' +expected="\ +/etc/data +/usr/share" + +. "$harness" diff --git a/tests/querydd.4 b/tests/querydd.4 new file mode 100755 index 0000000..9837fd3 --- /dev/null +++ b/tests/querydd.4 @@ -0,0 +1,14 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_DIRS=/usr/local/share:/usr/share:. + +arguments='data dirs' +expected="\ +/usr/local/share +/usr/share +." + +. "$harness" diff --git a/tests/querydd.5 b/tests/querydd.5 new file mode 100755 index 0000000..74f1670 --- /dev/null +++ b/tests/querydd.5 @@ -0,0 +1,11 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_DIRS="/path/with a few spaces" + +arguments='data dirs' +expected="/path/with a few spaces" + +. "$harness" diff --git a/tests/querydh.1 b/tests/querydh.1 new file mode 100755 index 0000000..a172699 --- /dev/null +++ b/tests/querydh.1 @@ -0,0 +1,11 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME= + +arguments='data home' +expected='/home/test/.local/share' + +. "$harness" diff --git a/tests/querydh.2 b/tests/querydh.2 new file mode 100755 index 0000000..0dc552a --- /dev/null +++ b/tests/querydh.2 @@ -0,0 +1,11 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME=/home/test/.data + +arguments='data home' +expected='/home/test/.data' + +. "$harness" diff --git a/tests/querydh.3 b/tests/querydh.3 new file mode 100755 index 0000000..ba2c102 --- /dev/null +++ b/tests/querydh.3 @@ -0,0 +1,11 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME="/path/with a few spaces" + +arguments='data home' +expected='/path/with a few spaces' + +. "$harness" diff --git a/tests/queryds.1 b/tests/queryds.1 new file mode 100755 index 0000000..2349248 --- /dev/null +++ b/tests/queryds.1 @@ -0,0 +1,16 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME= +export XDG_DATA_DIRS= + +arguments='data search' +expected="\ +/home/test/.local/share +/usr/local/share +/usr/share" + + +. "$harness" diff --git a/tests/queryds.2 b/tests/queryds.2 new file mode 100755 index 0000000..0a3f60a --- /dev/null +++ b/tests/queryds.2 @@ -0,0 +1,16 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME=/home/test/.data +export XDG_DATA_DIRS= + +arguments='data search' +expected="\ +/home/test/.data +/usr/local/share +/usr/share" + + +. "$harness" diff --git a/tests/queryds.3 b/tests/queryds.3 new file mode 100755 index 0000000..76dad86 --- /dev/null +++ b/tests/queryds.3 @@ -0,0 +1,17 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME=/home/test/.data +export XDG_DATA_DIRS=/usr/local/share:/usr/games/share:/usr/share + +arguments='data search' +expected="\ +/home/test/.data +/usr/local/share +/usr/games/share +/usr/share" + + +. "$harness" diff --git a/tests/queryds.4 b/tests/queryds.4 new file mode 100755 index 0000000..bc85040 --- /dev/null +++ b/tests/queryds.4 @@ -0,0 +1,17 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME= +export XDG_DATA_DIRS=/usr/local/share:/usr/games/share:/usr/share + +arguments='data search' +expected="\ +/home/test/.local/share +/usr/local/share +/usr/games/share +/usr/share" + + +. "$harness" diff --git a/tests/queryds.5 b/tests/queryds.5 new file mode 100755 index 0000000..8516e48 --- /dev/null +++ b/tests/queryds.5 @@ -0,0 +1,18 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME=/home/test/.data +export XDG_DATA_DIRS=/usr/local/share:/usr/games/share:/usr/share:. + +arguments='data search' +expected="\ +/home/test/.data +/usr/local/share +/usr/games/share +/usr/share +." + + +. "$harness" diff --git a/tests/queryds.6 b/tests/queryds.6 new file mode 100755 index 0000000..54555a2 --- /dev/null +++ b/tests/queryds.6 @@ -0,0 +1,17 @@ +#!/bin/sh + +harness="`dirname "$0"`/query-harness.sh" + +export HOME=/home/test +export XDG_DATA_HOME=/home/test/.data +export XDG_DATA_DIRS="/usr/local/share:/path/with a few spaces:/usr/share" + +arguments='data search' +expected="\ +/home/test/.data +/usr/local/share +/path/with a few spaces +/usr/share" + + +. "$harness" -- 2.11.4.GIT