summaryrefslogtreecommitdiff
path: root/tests/runtest.sh
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2010-11-14 22:47:04 +0000
committerNick White <git@njw.me.uk>2010-11-14 22:47:04 +0000
commit3d29579a6cb3be321296c12e27dfbf90fc9e26f9 (patch)
tree15c9e095193955bab61f2264adee7a5ee69c8a37 /tests/runtest.sh
parent159527a972b0a929aeda3dcbd71c71f1367189de (diff)
Add tests
Diffstat (limited to 'tests/runtest.sh')
-rwxr-xr-xtests/runtest.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/runtest.sh b/tests/runtest.sh
new file mode 100755
index 0000000..d3e8887
--- /dev/null
+++ b/tests/runtest.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# This test requires surf from http://surf.suckless.org,
+# patched with surfuri_js.patch
+
+test $# -ne 2 && echo usage $0 testhtml expectedoutput && exit 1
+
+testjs=tests/showsimple.js
+htmlloadtime=2
+scriptloadtime=2
+
+surf -x "file://./$1" > testxid 2>testoutput &
+pid=$!
+sleep $htmlloadtime
+xid=`cat testxid`
+xprop -id $xid -f _SURF_GO 8t -set _SURF_GO "javascript:`cat $testjs`"
+sleep $scriptloadtime
+kill $pid
+
+sed 's/^\*\* Message:[^<]*//g' < testoutput > testoutputbody
+
+diff "$2" testoutputbody
+result=$?
+
+rm -f testxid testoutput testoutputbody
+exit $result