← Back to team overview

zeitgeist team mailing list archive

[Branch ~zeitgeist/zeitgeist/bluebird] Rev 354: Some test cases cleanup:

 

------------------------------------------------------------
revno: 354
committer: Siegfried-Angel Gevatter Pujals <siegfried@xxxxxxxxxxxx>
branch nick: bluebird
timestamp: Sat 2011-12-31 01:31:17 +0100
message:
  Some test cases cleanup:
   - Rename marshalling to marshalling-test and add copyright header.
   - Make all tests exit with 0 on success.
   - Use :memory: database in query-operators-test (it's not used, but
     it's connected to).
renamed:
  test/direct/marshalling.vala => test/direct/marshalling-test.vala
modified:
  .bzrignore
  test/direct/Makefile.am
  test/direct/mimetype-test.vala
  test/direct/query-operators-test.vala
  test/direct/table-lookup-test.vala
  test/direct/where-clause-test.vala
  test/direct/marshalling-test.vala


--
lp:zeitgeist
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch lp:zeitgeist.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file '.bzrignore'
--- .bzrignore	2011-12-29 12:02:38 +0000
+++ .bzrignore	2011-12-31 00:31:17 +0000
@@ -55,3 +55,4 @@
 test/direct/*.c
 src/zeitgeist-daemon
 mimetype-test
+marshalling-test

=== modified file 'test/direct/Makefile.am'
--- test/direct/Makefile.am	2011-12-29 12:02:38 +0000
+++ test/direct/Makefile.am	2011-12-31 00:31:17 +0000
@@ -9,7 +9,7 @@
 	$(NULL)
 
 TESTS = \
-	marshalling \
+	marshalling-test \
 	query-operators-test \
 	where-clause-test \
 	table-lookup-test \
@@ -35,7 +35,7 @@
 	$(top_srcdir)/src/mimetype.vala \
 	$(NULL)
 
-marshalling: marshalling.vala $(SRC_FILES)
+marshalling-test: marshalling-test.vala $(SRC_FILES)
 	$(VALAC) $(VALAFLAGS) -o $@ $^
 
 query-operators-test: query-operators-test.vala $(SRC_FILES)
@@ -54,7 +54,7 @@
 	rm -f *.~[0-9]~
 
 DISTCLEANFILES = \
-	marshalling \
+	marshalling-test \
 	query-operators-test \
 	where-clause-test \
 	table-lookup-test \
@@ -62,7 +62,7 @@
 	$(NULL)
 
 EXTRA_DIST = \
-	marshalling.vala \
+	marshalling-test.vala \
 	query-operators-test.vala \
 	where-clause-test.vala \
 	table-lookup-test.vala \

=== renamed file 'test/direct/marshalling.vala' => 'test/direct/marshalling-test.vala'
--- test/direct/marshalling.vala	2011-09-17 19:38:43 +0000
+++ test/direct/marshalling-test.vala	2011-12-31 00:31:17 +0000
@@ -1,5 +1,35 @@
+/* marshalling-test.vala
+ *
+ * Copyright © 2011 Michal Hruby <michal.mhr@xxxxxxxxx>
+ *
+ * This program 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.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
 using Zeitgeist;
 
+int main (string[] argv)
+{
+  Test.init (ref argv);
+
+  Test.add_func ("/marshalling/subjects", subject_test);
+  Test.add_func ("/marshalling/event", event_test);
+  Test.add_func ("/marshalling/events", events_test);
+
+  return Test.run ();
+}
+
 Subject create_subject ()
 {
   var s = new Subject ();
@@ -63,14 +93,3 @@
   var demarshalled = Events.from_variant (vevents);
   assert (demarshalled.length == 1000);
 }
-
-int main (string[] argv)
-{
-  Test.init (ref argv);
-
-  Test.add_func ("/marshalling/subjects", subject_test);
-  Test.add_func ("/marshalling/event", event_test);
-  Test.add_func ("/marshalling/events", events_test);
-
-  return Test.run ();
-}

=== modified file 'test/direct/mimetype-test.vala'
--- test/direct/mimetype-test.vala	2011-12-29 12:02:38 +0000
+++ test/direct/mimetype-test.vala	2011-12-31 00:31:17 +0000
@@ -23,7 +23,7 @@
 using Zeitgeist;
 using Assertions;
 
-void main (string[] args)
+int main (string[] args)
 {
     Test.init (ref args);
 
@@ -36,7 +36,7 @@
     Test.add_func ("/UriScheme/none", uri_scheme_none_test);
     Test.add_func ("/UriScheme/register", uri_scheme_registration_test);
 
-    Test.run ();
+    return Test.run ();
 }
 
 public void mime_type_basic_test ()

=== modified file 'test/direct/query-operators-test.vala'
--- test/direct/query-operators-test.vala	2011-12-04 22:58:25 +0000
+++ test/direct/query-operators-test.vala	2011-12-31 00:31:17 +0000
@@ -18,7 +18,7 @@
  *
  */
 
-void main (string[] args)
+int main (string[] args)
 {
 
     Test.init (ref args);
@@ -26,6 +26,13 @@
     // Do not abort on warning()s.
     Log.set_always_fatal (LogLevelFlags.LEVEL_CRITICAL);
 
+	// This test will connect to the database, make sure it won't mess up
+    // anything.
+    assert (Environment.set_variable(
+        "ZEITGEIST_DATA_PATH", "/tmp/zeitgeist-tests", true));
+    assert (Environment.set_variable(
+        "ZEITGEIST_DATABASE_PATH", ":memory:", true));
+
     Test.add_func ("/ParseNegation/main", parse_negation_test);
     Test.add_func ("/ParseNegation/assert", assert_no_negation_test);
     Test.add_func ("/ParseNoexpand/main", parse_noexpand_test);
@@ -33,7 +40,7 @@
     Test.add_func ("/ParseWildcard/main", parse_wildcard_test);
 	Test.add_func ("/ParseWildlcard/assert", assert_no_wildcard_test);
 
-    Test.run ();
+    return Test.run ();
 }
 
 private class PublicEngine : Zeitgeist.Engine

=== modified file 'test/direct/table-lookup-test.vala'
--- test/direct/table-lookup-test.vala	2011-09-17 19:38:43 +0000
+++ test/direct/table-lookup-test.vala	2011-12-31 00:31:17 +0000
@@ -22,7 +22,7 @@
 using Zeitgeist.SQLite;
 using Assertions;
 
-void main (string[] args)
+int main (string[] args)
 {
     Test.init (ref args);
 
@@ -38,7 +38,8 @@
 
     Test.add_func ("/WhereClause/basic", basic_test);
     Test.add_func ("/WhereClause/delete_hook", engine_test);
-    Test.run ();
+
+    return Test.run ();
 }
 
 private class PublicEngine : Zeitgeist.Engine

=== modified file 'test/direct/where-clause-test.vala'
--- test/direct/where-clause-test.vala	2011-08-16 14:32:42 +0000
+++ test/direct/where-clause-test.vala	2011-12-31 00:31:17 +0000
@@ -21,7 +21,7 @@
 using Zeitgeist;
 using Assertions;
 
-void main (string[] args)
+int main (string[] args)
 {
     Test.init (ref args);
 
@@ -33,7 +33,8 @@
     Test.add_func ("/WhereClause/nested_negation", nested_negation_test);
     Test.add_func ("/WhereClause/match_condition", match_condition_test);
     Test.add_func ("/WhereClause/glob/right_boundary", right_boundary_test);
-    Test.run ();
+
+    return Test.run ();
 }
 
 private class PublicWhereClause : WhereClause