From 4c3a26dc92d71e15d00b1b0fbf16f1fddc3abec1 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 31 Dec 2010 10:44:50 +0100 Subject: tests/pllua: new test Test that pllua works. http://redmine.alpinelinux.org/issues/503 This also tests that postgresql works. --- tests/pllua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/pllua 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 + -- cgit v1.2.3