Browse Source

Declare the migration-shape tests as throwing, drop unreachable catch clauses

Migration.up()/down() are throws SqlError; the test functions now declare
that and a single handled try wraps both, removing the unhandled-error and
unreachable-catch warnings from the test build.
saddle-Clanker-Saddle 4 weeks ago
parent
commit
8ad595855e
1 changed files with 9 additions and 4 deletions
  1. 9 4
      tests/TestMain.vala

+ 9 - 4
tests/TestMain.vala

@@ -96,7 +96,7 @@ namespace Spry.Tests {
      * DEFAULT (the SQLite dialect cannot render a DateTime default), so
      * existing rows keep working with a NULL epoch.
      */
-    void test_m0002_sql_shape() {
+    void test_m0002_sql_shape() throws GLib.Error {
         var migration = new M0002_SessionsValidAfter();
         check(migration.serial == 2, "M0002: serial is 2 (ordered after M0001)");
         check(migration.migration_namespace == "spry-authentication",
@@ -125,7 +125,7 @@ namespace Spry.Tests {
      * M0002 down(): the column is dropped again, so the migration is
      * reversible (losing only the epoch, never user rows).
      */
-    void test_m0002_down_shape() {
+    void test_m0002_down_shape() throws GLib.Error {
         var migration = new M0002_SessionsValidAfter();
         var builder = new MigrationBuilder(new SqliteDialect());
         migration.down(builder);
@@ -155,11 +155,16 @@ namespace Spry.Tests {
     }
 
     public int main(string[] args) {
+        try {
+            test_m0002_sql_shape();
+            test_m0002_down_shape();
+        } catch (GLib.Error e) {
+            failures++;
+            print("FAIL M0002 migration shape threw: %s\n", e.message);
+        }
         test_epoch_comparison();
         test_null_epoch_is_unix_epoch();
         test_epoch_now_is_usable_bump();
-        test_m0002_sql_shape();
-        test_m0002_down_shape();
         test_permission_matching_untouched();
 
         print("---- %d passed, %d failed ----\n", passes, failures);