summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-12-31 10:44:50 +0100
committerJeff Bilyk <jbilyk@gmail.com>2011-01-01 10:34:38 +0000
commit4c3a26dc92d71e15d00b1b0fbf16f1fddc3abec1 (patch)
tree61d78bd696d61fc7fa0ecf5231851ab4af20fe95
parent8fa277b944079fc882d2b7c6aeb7128448a24ec5 (diff)
downloadapts-4c3a26dc92d71e15d00b1b0fbf16f1fddc3abec1.tar.bz2
apts-4c3a26dc92d71e15d00b1b0fbf16f1fddc3abec1.tar.xz
tests/pllua: new test
Test that pllua works. http://redmine.alpinelinux.org/issues/503 This also tests that postgresql works.
-rw-r--r--tests/pllua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/pllua b/tests/pllua
new file mode 100644
index 0000000..2821122
--- /dev/null
+++ b/tests/pllua
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# this test is due to:
+# http://redmine.alpinelinux.org/issues/503
+
+# pllua test is from:
+# http://pllua.projects.postgresql.org/
+
+apk_add postgresql pllua
+/etc/init.d/postgresql start
+
+# create db and pllua language
+psql -U postgres -c 'create database aptstest'
+psql -U postgres -f /usr/share/postgresql/contrib/pllua.sql aptstest
+
+# create function
+psql -U postgres -d aptstest -c '
+CREATE FUNCTION hello(name text) RETURNS text AS $$
+ return string.format("hello:%s", name)
+$$ LANGUAGE pllua;
+'
+
+# test that lua function works
+psql -U postgres -d aptstest -c "SELECT hello('lua');" | grep 'hello:lua'
+
+# cleanup
+psql -U postgres -c 'drop database aptstest'
+/etc/init.d/postgresql stop
+apk_del pllua postgresql
+