[vala/wip/valadate: 132/137] Minor refactoring



commit 03ee32119009f38f74866567a4d5b52ae35be21d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Sep 26 12:45:29 2016 +0200

    Minor refactoring

 valadate/Makefile.am                          |    2 +-
 valadate/test.vala                            |   29 ----------------------
 valadate/testcase.vala                        |   12 ++++----
 valadate/{assembly.vala => testiterator.vala} |   32 ++++++++++++++++++++++--
 4 files changed, 36 insertions(+), 39 deletions(-)
---
diff --git a/valadate/Makefile.am b/valadate/Makefile.am
index 869bea6..2893d66 100644
--- a/valadate/Makefile.am
+++ b/valadate/Makefile.am
@@ -21,13 +21,13 @@ lib_LTLIBRARIES = \
        $(NULL)
 
 libvaladate_la_VALASOURCES = \
-       assembly.vala \
        module.vala \
        test.vala \
        testcase.vala \
        testconfig.vala \
        testexplorer.vala \
        testfixture.vala \
+       testiterator.vala \
        testresult.vala \
        testrunner.vala \
        testsuite.vala \
diff --git a/valadate/test.vala b/valadate/test.vala
index a3d2669..f49e928 100644
--- a/valadate/test.vala
+++ b/valadate/test.vala
@@ -47,33 +47,4 @@ public interface Valadate.Test : Object {
        public virtual TestIterator iterator() {
                return new TestIterator(this);
        }
-       
-       public class TestIterator {
-               
-               private Test test;
-               private Test current;
-               private int index = 0;
-               
-               public TestIterator(Test test) {
-                       this.test = test;
-               }
-               
-               public Test get() {
-                       current = this.test.get_test(index);
-                       index++;
-                       return current;
-               }
-
-               public bool next() {
-                       if (index >= this.test.count)
-                               return false;
-                       return true;
-               }
-
-               public int size {
-                       get {
-                               return this.test.count;
-                       }
-               }
-       }
 }
diff --git a/valadate/testcase.vala b/valadate/testcase.vala
index 44286f6..eecc5fc 100644
--- a/valadate/testcase.vala
+++ b/valadate/testcase.vala
@@ -28,13 +28,13 @@ public errordomain Valadate.TestError {
        NOT_FOUND
 }
 
-public abstract class Valadate.TestCase : Object, Test, TestFixture {
+/**
+ * The TestMethod delegate represents a {@link Valadate.Test} method
+ * that can be added to a TestCase and run
+ */
+public delegate void Valadate.TestMethod ();
 
-       /**
-        * The TestMethod delegate represents a {@link Valadate.Test} method
-        * that can be added to a TestCase and run
-        */
-       public delegate void TestMethod ();
+public abstract class Valadate.TestCase : Object, Test, TestFixture {
 
        /**
         * the name of the TestCase
diff --git a/valadate/assembly.vala b/valadate/testiterator.vala
similarity index 68%
rename from valadate/assembly.vala
rename to valadate/testiterator.vala
index b7f0c3d..4f4ef4a 100644
--- a/valadate/assembly.vala
+++ b/valadate/testiterator.vala
@@ -15,10 +15,36 @@
  * 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
- * 
+ *
  * Authors:
  *     Chris Daley <chebizarro gmail com>
  */
+/**
+ * The Test iterator
+ */
+public class Valadate.TestIterator {
+
+       public int size {
+               get {
+                       return this.test.count;
+               }
+       }
+
+       private Test test;
+       private Test current;
+       private int index = 0;
+
+       public TestIterator (Test test) {
+               this.test = test;
+       }
+
+       public Test get () {
+               current = this.test.get_test (index);
+               index++;
+               return current;
+       }
 
-[CCode (gir_namespace = "Valadate", gir_version = "1.0")]
-namespace Valadate { }
+       public bool next () {
+               return (index < this.test.count);
+       }
+}


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