summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTom Whipple <tw@tomwhipple.com>2006-08-04 18:47:29 +0000
committerTom Whipple <tw@tomwhipple.com>2006-08-04 18:47:29 +0000
commitd54c803c0077c7fa2e89aeb5a49d798770c6252e (patch)
treefe8831c4045cdcb57294390a35b900887d3f6529 /tests
parent0121d3067ff5efad92bcd3399acb5709bd56f678 (diff)
rename tests to enforce order
Diffstat (limited to 'tests')
-rwxr-xr-xtests/xdg-open/t.00-apply_generic10
-rwxr-xr-xtests/xdg-open/t.01-open_basic35
-rwxr-xr-xtests/xdg-open/t.02-open_dir30
-rwxr-xr-xtests/xdg-open/t.03-open_url30
-rwxr-xr-xtests/xdg-open/t.04-open_html34
-rwxr-xr-xtests/xdg-open/t.05-open_abs_path_html34
6 files changed, 173 insertions, 0 deletions
diff --git a/tests/xdg-open/t.00-apply_generic b/tests/xdg-open/t.00-apply_generic
new file mode 100755
index 0000000..1e1279d
--- /dev/null
+++ b/tests/xdg-open/t.00-apply_generic
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+. "$XDG_TEST_DIR/include/testcontrol.sh"
+
+generic_tests=`ls $XDG_TEST_DIR/generic/t.*`
+for t in $generic_tests; do
+ . "$t"
+ repeat_test "$GENERIC_TEST" 1 "XDGUTIL" "xdg-open"
+done
+
diff --git a/tests/xdg-open/t.01-open_basic b/tests/xdg-open/t.01-open_basic
new file mode 100755
index 0000000..48a04c4
--- /dev/null
+++ b/tests/xdg-open/t.01-open_basic
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+## Include utility functions.
+. "$XDG_TEST_DIR/include/testassertions.sh"
+. "$XDG_TEST_DIR/include/testcontrol.sh"
+
+## Test function
+test_open_basic() {
+test_start "$FUNCNAME: verify basic file open test."
+
+test_init
+
+require_notroot
+
+## Require a running X server
+assert_display
+
+get_unique_name TARG 'open.txt'
+echo "I am open." > $TARG
+assert_file "$TARG"
+
+
+test_procedure
+
+assert_exit 0 xdg-open $TARG
+assert_nostdout
+assert_nostderr
+
+assert_interactive "Did a text editor open a file containing the string 'I am open.'?" y
+assert_interactive "Please close any windows opened by this test." C
+
+test_result
+}
+
+run_test test_open_basic
diff --git a/tests/xdg-open/t.02-open_dir b/tests/xdg-open/t.02-open_dir
new file mode 100755
index 0000000..835f3b2
--- /dev/null
+++ b/tests/xdg-open/t.02-open_dir
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+## Include utility functions.
+. "$XDG_TEST_DIR/include/testassertions.sh"
+. "$XDG_TEST_DIR/include/testcontrol.sh"
+
+## Test function
+test_open_dir() {
+test_start "$FUNCNAME: verify basic directory open test."
+
+test_init
+
+require_notroot
+
+## Require a running X server
+assert_display
+
+test_procedure
+
+assert_exit 0 xdg-open "$XDG_TEST_DIR"
+assert_nostdout
+assert_nostderr
+
+assert_interactive "Did a file browser open to $XDG_TEST_DIR?" y
+assert_interactive "Please close any windows opened by this test." C
+
+test_result
+}
+
+run_test test_open_dir
diff --git a/tests/xdg-open/t.03-open_url b/tests/xdg-open/t.03-open_url
new file mode 100755
index 0000000..82f59eb
--- /dev/null
+++ b/tests/xdg-open/t.03-open_url
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+## Include utility functions.
+. "$XDG_TEST_DIR/include/testassertions.sh"
+. "$XDG_TEST_DIR/include/testcontrol.sh"
+
+## Test function
+test_open_url() {
+test_start "$FUNCNAME: HTTP open test."
+URL="http://portland.freedesktop.org/wiki/"
+
+test_init
+
+require_notroot
+## Require a running X server
+assert_display
+
+test_procedure
+
+assert_exit 0 xdg-open "$URL"
+assert_nostdout
+assert_nostderr
+
+assert_interactive "Did a web browser open to '$URL'" y
+assert_interactive "Please close any windows opened by this test." C
+
+test_result
+}
+
+run_test test_open_url
diff --git a/tests/xdg-open/t.04-open_html b/tests/xdg-open/t.04-open_html
new file mode 100755
index 0000000..baef6e0
--- /dev/null
+++ b/tests/xdg-open/t.04-open_html
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+## Include utility functions.
+. "$XDG_TEST_DIR/include/testassertions.sh"
+. "$XDG_TEST_DIR/include/testcontrol.sh"
+
+## Test function
+FILE=testfile.html
+test_open_html() {
+test_start "$FUNCNAME: open '$PRE$FILE'"
+
+test_init
+
+require_notroot
+
+## Require a running X server
+assert_display
+
+echo '<html><body>I am an HTML file!</body></html>' >"$FILE"
+assert_file "$FILE"
+
+test_procedure
+
+assert_exit 0 xdg-open "$PRE$FILE"
+assert_nostdout
+assert_nostderr
+
+assert_interactive "Did an HTML file open containing the text 'I am an HTML file!'?" y
+assert_interactive "Please close any windows opened by this test." C
+
+test_result
+}
+
+repeat_test test_open_html 1 PRE '' './'
diff --git a/tests/xdg-open/t.05-open_abs_path_html b/tests/xdg-open/t.05-open_abs_path_html
new file mode 100755
index 0000000..94a52bc
--- /dev/null
+++ b/tests/xdg-open/t.05-open_abs_path_html
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+## Include utility functions.
+. "$XDG_TEST_DIR/include/testassertions.sh"
+. "$XDG_TEST_DIR/include/testcontrol.sh"
+
+## Test function
+FILE=testfile.html
+test_open_abs_path_html() {
+test_start "$FUNCNAME: open absalute path of the form '$PRE/path/file.html'"
+
+test_init
+
+require_notroot
+
+## Require a running X server
+assert_display
+
+echo '<html><body>I am an HTML file!</body></html>' >"$FILE"
+assert_file "$FILE"
+
+test_procedure
+
+assert_exit 0 xdg-open "$PRE$XDG_TEST_TMPDIR/$FILE"
+assert_nostdout
+assert_nostderr
+
+assert_interactive "Did an HTML file open containing the text 'I am an HTML file!'?" y
+assert_interactive "Please close any windows opened by this test." C
+
+test_result
+}
+
+repeat_test test_open_abs_path_html 1 PRE '' 'file://'