[vala/wip/valadate: 173/177] Rename Module to TestModule



commit 0ace147ce4b5b990a6966226302c57cadfa98306
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Sep 26 20:01:31 2016 +0200

    Rename Module to TestModule

 valadate/Makefile.am                      |    2 +-
 valadate/testexplorer.vala                |   14 +++++++-------
 valadate/{module.vala => testmodule.vala} |   16 ++++++++--------
 3 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/valadate/Makefile.am b/valadate/Makefile.am
index 1d6dbf7..6c71cf8 100644
--- a/valadate/Makefile.am
+++ b/valadate/Makefile.am
@@ -21,12 +21,12 @@ lib_LTLIBRARIES = \
        $(NULL)
 
 libvaladate_la_VALASOURCES = \
-       module.vala \
        test.vala \
        testcase.vala \
        testconfig.vala \
        testexplorer.vala \
        testiterator.vala \
+       testmodule.vala \
        testresult.vala \
        testrunner.vala \
        testsuite.vala \
diff --git a/valadate/testexplorer.vala b/valadate/testexplorer.vala
index 97a72f2..7c12b9c 100644
--- a/valadate/testexplorer.vala
+++ b/valadate/testexplorer.vala
@@ -27,7 +27,7 @@ internal class Valadate.TestExplorer : Vala.CodeVisitor {
 
        private TestSuite current;
        private Vala.CodeContext context;
-       private Module module;
+       private TestModule module;
        private string binary;
        private string? running;
 
@@ -50,10 +50,10 @@ internal class Valadate.TestExplorer : Vala.CodeVisitor {
                        throw new ConfigError.TESTPLAN ("Test Plan %s Not Found!", testplanfile);
 
                try {
-                       module = new Module (binary);
+                       module = new TestModule (binary);
                        module.load_module ();
                        load_test_plan (testplanfile);
-               } catch (ModuleError e) {
+               } catch (TestModuleError e) {
                        throw new ConfigError.MODULE (e.message);
                }
        }
@@ -83,7 +83,7 @@ internal class Valadate.TestExplorer : Vala.CodeVisitor {
                                class.is_abstract != true)
                                current.add_test (visit_testsuite (class));
 
-               } catch (ModuleError e) {
+               } catch (TestModuleError e) {
                        error (e.message);
                }
                class.accept_children (this);
@@ -96,12 +96,12 @@ internal class Valadate.TestExplorer : Vala.CodeVisitor {
                return false;
        }
 
-       private unowned Constructor get_constructor (Vala.Class class) throws ModuleError {
+       private unowned Constructor get_constructor (Vala.Class class) throws TestModuleError {
                var attr = new Vala.CCodeAttribute (class.default_construction_method);
                return (Constructor)module.get_method (attr.name);
        }
 
-       public TestCase visit_testcase (Vala.Class testclass) throws ModuleError {
+       public TestCase visit_testcase (Vala.Class testclass) throws TestModuleError {
                unowned Constructor meth = get_constructor(testclass);
                var current_test = meth () as TestCase;
                current_test.name = testclass.name;
@@ -129,7 +129,7 @@ internal class Valadate.TestExplorer : Vala.CodeVisitor {
                return current_test;
        }
 
-       public TestSuite visit_testsuite (Vala.Class testclass) throws ModuleError {
+       public TestSuite visit_testsuite (Vala.Class testclass) throws TestModuleError {
                unowned Constructor meth = get_constructor (testclass);
                var current_test = meth () as TestSuite;
                current_test.name = testclass.name;
diff --git a/valadate/module.vala b/valadate/testmodule.vala
similarity index 75%
rename from valadate/module.vala
rename to valadate/testmodule.vala
index 1cf32c8..eda6ac5 100644
--- a/valadate/module.vala
+++ b/valadate/testmodule.vala
@@ -20,7 +20,7 @@
  *     Chris Daley <chebizarro gmail com>
  */
 
-public errordomain Valadate.ModuleError {
+public errordomain Valadate.TestModuleError {
        NOT_FOUND,
        LOAD,
        METHOD
@@ -29,30 +29,30 @@ public errordomain Valadate.ModuleError {
 /**
  * Represents a loadable module containing {@link Valadate.Test}s
  */
-public class Valadate.Module : Object {
+public class Valadate.TestModule : Object {
 
        private string lib_path;
        private GLib.Module module;
 
-       public Module (string libpath) {
+       public TestModule (string libpath) {
                lib_path = libpath;
        }
 
-       public void load_module () throws ModuleError {
+       public void load_module () throws TestModuleError {
                if (!File.new_for_path (lib_path).query_exists ())
-                       throw new ModuleError.NOT_FOUND ("Module: %s does not exist", lib_path);
+                       throw new TestModuleError.NOT_FOUND ("Module: %s does not exist", lib_path);
                
                module = GLib.Module.open (lib_path, ModuleFlags.BIND_LOCAL);
                if (module == null)
-                       throw new ModuleError.LOAD (GLib.Module.error ());
+                       throw new TestModuleError.LOAD (GLib.Module.error ());
                module.make_resident ();
        }
 
-       internal void* get_method (string method_name) throws ModuleError {
+       internal void* get_method (string method_name) throws TestModuleError {
                void* function;
                if (module.symbol (method_name, out function))
                        if (function != null)
                                return function;
-               throw new ModuleError.METHOD (GLib.Module.error ());
+               throw new TestModuleError.METHOD (GLib.Module.error ());
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]