summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/setup.sh1
-rwxr-xr-xtest/t2600-rendercomment.sh22
2 files changed, 23 insertions, 0 deletions
diff --git a/test/setup.sh b/test/setup.sh
index b71e73e8..f29695a6 100644
--- a/test/setup.sh
+++ b/test/setup.sh
@@ -16,6 +16,7 @@ TUVOTEREMINDER="$TOPLEVEL/aurweb/scripts/tuvotereminder.py"
PKGMAINT="$TOPLEVEL/aurweb/scripts/pkgmaint.py"
AURBLUP="$TOPLEVEL/aurweb/scripts/aurblup.py"
NOTIFY="$TOPLEVEL/aurweb/scripts/notify.py"
+RENDERCOMMENT="$TOPLEVEL/aurweb/scripts/rendercomment.py"
# Create the configuration file and a dummy notification script.
cat >config <<-EOF
diff --git a/test/t2600-rendercomment.sh b/test/t2600-rendercomment.sh
new file mode 100755
index 00000000..8d79336d
--- /dev/null
+++ b/test/t2600-rendercomment.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+test_description='rendercomment tests'
+
+. ./setup.sh
+
+test_expect_success 'Test comment rendering.' '
+ cat <<-EOD | sqlite3 aur.db &&
+ INSERT INTO PackageComments (ID, PackageBaseID, Comments, RenderedComment) VALUES (1, 1, "Hello world!
+ This is a comment.", "");
+ EOD
+ "$RENDERCOMMENT" 1 &&
+ cat <<-EOD >expected &&
+ Hello world!<br>This is a comment.
+ EOD
+ cat <<-EOD | sqlite3 aur.db >actual &&
+ SELECT RenderedComment FROM PackageComments WHERE ID = 1;
+ EOD
+ test_cmp actual expected
+'
+
+test_done