summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2016-02-27 11:36:47 +0100
committerJens Georg <mail@jensge.org>2016-02-27 12:04:47 +0100
commit997d8ea4ab0401a63fe3037156626eb41ad9346a (patch)
tree07cfadac8b4152ccb59e0d09406e86867a213d72 /tests
parent2020194c8e3d20b7a9f89e5832c4177a86bfc00b (diff)
downloadrygel-997d8ea4ab0401a63fe3037156626eb41ad9346a.tar.gz
tests: Move database test into own file
Signed-off-by: Jens Georg <mail@jensge.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am15
-rw-r--r--tests/rygel-database-test.vala54
2 files changed, 68 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 47db215c..2a925275 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,8 @@ AUTOMAKE_OPTIONS = subdir-objects
check_PROGRAMS = rygel-regression \
rygel-user-config-test \
rygel-searchable-container-test \
- rygel-object-creator-test
+ rygel-object-creator-test \
+ rygel-database-test
TESTS = $(check_PROGRAMS)
@@ -165,6 +166,18 @@ rygel_regression_CFLAGS = \
rygel_regression_LDADD = \
$(test_server_libs)
+rygel_database_test_SOURCES = \
+ rygel-database-test.vala
+rygel_database_test_VALAFLAGS = \
+ $(test_valaflags) \
+ $(RYGEL_COMMON_LIBRYGEL_DB_VALAFLAGS)
+rygel_database_test_CFLAGS = \
+ $(test_cflags) \
+ $(RYGEL_COMMON_LIBRYGEL_DB_CFLAGS)
+rygel_database_test_LDADD = \
+ $(test_libs) \
+ $(RYGEL_COMMON_LIBRYGEL_DB_LIBS)
+
#rygel_media_engine_test_SOURCES = \
# rygel-media-engine-test.vala
#rygel_media_engine_test_VALAFLAGS = \
diff --git a/tests/rygel-database-test.vala b/tests/rygel-database-test.vala
new file mode 100644
index 00000000..058f9f62
--- /dev/null
+++ b/tests/rygel-database-test.vala
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 Intel Corporation.
+ *
+ * Author: Jens Georg <jensg@openismus.com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * Test that database errors are reported correctly. This is a side-bug
+ * discovered during fixing this bug.
+ */
+public void test_bgo683926_1 () {
+ Rygel.Database.Database db = null;
+
+ try {
+ db = new Rygel.Database.Database (":memory:");
+ db.exec ("create table object (id text not null, title text not null);");
+ db.exec ("insert into object (id, title) VALUES ('a', 'b');");
+ } catch (Error e) {
+ error ("=> Database preparation failed: %s", e.message);
+ }
+
+ try {
+ Value[] val = { "c" };
+ db.exec ("replace into object (title) VALUES (?);", val);
+ assert_not_reached ();
+ } catch (Error e) {
+ // Receiving an error here is expected
+ }
+}
+
+int main (string[] args) {
+ Test.init (ref args);
+
+ Test.add_func ("/librygel-db/regression/bgo689326_1",
+ test_bgo683926_1);
+
+ return Test.run ();
+}