[vala/wip/valadate: 87/101] more code style changes



commit 3a6d0333641381f0fff587aaa8569bea05fc0342
Author: Chris Daley <chebizarro gmail com>
Date:   Fri Apr 28 16:02:10 2017 -0700

    more code style changes

 valadate/assembly.vala             |   12 +++++-----
 valadate/testadapter.vala          |   17 +++++++--------
 valadate/testgatherer.vala         |    4 +--
 valadate/testplan.vala             |   37 ++++++++++++-----------------------
 valadate/testreport.vala           |   10 ++++----
 valadate/testresult.vala           |    4 +-
 valadate/testsuite.vala            |   13 ++++++-----
 valadate/xmltestreportprinter.vala |    2 +-
 8 files changed, 43 insertions(+), 56 deletions(-)
---
diff --git a/valadate/assembly.vala b/valadate/assembly.vala
index aa48c7c..26159a0 100644
--- a/valadate/assembly.vala
+++ b/valadate/assembly.vala
@@ -22,7 +22,7 @@
 
 public abstract class Valadate.Assembly {
 
-       protected static SubprocessLauncher launcher;
+       private static SubprocessLauncher launcher;
 
        private static void init_launcher () {
                if (launcher == null) {
@@ -36,12 +36,12 @@ public abstract class Valadate.Assembly {
                }
        }
 
-       public File binary {get;set;}
-       public InputStream stderr {get;set;}
-       public OutputStream stdin {get;set;}
-       public InputStream stdout {get;set;}
+       public File binary { get; set; }
+       public InputStream stderr { get; set; }
+       public OutputStream stdin { get; set; }
+       public InputStream stdout { get; set; }
 
-       protected Subprocess process;
+       private Subprocess process;
 
        public Assembly (File binary) throws Error {
                init_launcher ();
diff --git a/valadate/testadapter.vala b/valadate/testadapter.vala
index e3849f4..d20910a 100644
--- a/valadate/testadapter.vala
+++ b/valadate/testadapter.vala
@@ -22,14 +22,14 @@
 
 public class Valadate.TestAdapter : Object, Test {
 
-       public string name {get;set;}
-       public string label {get;set;}
-       public double time {get;set;}
+       public string name { get; set; }
+       public string label { get; set; }
+       public double time { get; set; }
 
-       public int timeout {get;set;}
+       public int timeout { get; set; }
 
-       public TestStatus status {get;set;default=TestStatus.NOT_RUN;}
-       public string status_message {get;set;}
+       public TestStatus status { get; set; default = TestStatus.NOT_RUN; }
+       public string status_message { get; set; }
 
        public int count {
                get {
@@ -44,7 +44,7 @@ public class Valadate.TestAdapter : Object, Test {
        }
 
        private TestCase.TestMethod test;
-       public Test? parent {get;set;}
+       public Test? parent { get; set; }
 
        public new Test get (int index) {
                return this;
@@ -80,8 +80,7 @@ public class Valadate.TestAdapter : Object, Test {
                        Priority.HIGH);
                        loop.run ();
                        if (result == null)
-                               throw new IOError.TIMED_OUT (
-                                       "The test timed out after %d milliseconds",timeout);
+                               throw new IOError.TIMED_OUT ("The test timed out after %d 
milliseconds",timeout);
                        async_finish (p, result);
                };
        }
diff --git a/valadate/testgatherer.vala b/valadate/testgatherer.vala
index e61a817..63dca58 100644
--- a/valadate/testgatherer.vala
+++ b/valadate/testgatherer.vala
@@ -48,9 +48,7 @@ public class Valadate.TestGatherer : Vala.CodeVisitor {
 
        private Type find_type (Vala.Class cls) throws Error {
                var attr = new Vala.CCodeAttribute (cls);
-               unowned TestPlan.GetType node_get_type =
-                        (TestPlan.GetType)assembly.get_method (
-                               "%sget_type".printf (attr.lower_case_prefix));
+               unowned TestPlan.GetType node_get_type = (TestPlan.GetType)assembly.get_method 
("%sget_type".printf (attr.lower_case_prefix));
                var ctype = node_get_type ();
                return ctype;
        }
diff --git a/valadate/testplan.vala b/valadate/testplan.vala
index 9c32b1d..d8dc669 100644
--- a/valadate/testplan.vala
+++ b/valadate/testplan.vala
@@ -30,19 +30,19 @@ public class Valadate.TestPlan : Vala.CodeVisitor {
 
        public delegate Type GetType ();
 
-       public File plan {get;set;}
+       public File plan { get; set; }
 
-       public TestAssembly assembly {get;set;}
+       public TestAssembly assembly { get; set; }
 
-       public TestOptions options {get;set;}
+       public TestOptions options { get; set; }
 
-       public TestConfig config {get;set;}
+       public TestConfig config { get; set; }
 
-       public TestResult result {get;set;}
+       public TestResult result { get; set; }
 
-       public TestRunner runner {get;set;}
+       public TestRunner runner { get; set; }
 
-       public TestSuite root {get;protected set;}
+       public TestSuite root { get; set; }
 
        private Vala.CodeContext context;
        private TestGatherer gatherer;
@@ -62,10 +62,8 @@ public class Valadate.TestPlan : Vala.CodeVisitor {
                plan = assembly.srcdir.get_child (plan_name + ".vapi");
                if (!plan.query_exists ()) {
                        plan = assembly.builddir.get_child (plan_name + ".vapi");
-                       if (!plan.query_exists ()) {
-                               throw new TestConfigError.TESTPLAN (
-                                       "Test Plan %s Not Found in %s or %s", plan_name, 
assembly.srcdir.get_path (), assembly.builddir.get_path ());
-                       }
+                       if (!plan.query_exists ())
+                               throw new TestConfigError.TESTPLAN ("Test Plan %s Not Found in %s or %s", 
plan_name, assembly.srcdir.get_path (), assembly.builddir.get_path ());
                }
                config = new TestConfig (options);
                runner = new TestRunner ();
@@ -182,10 +180,8 @@ public class Valadate.TestPlan : Vala.CodeVisitor {
 
                                if (method.coroutine) {
                                        try {
-                                               unowned TestPlan.AsyncTestMethod beginmethod =
-                                                        (TestPlan.AsyncTestMethod)assembly.get_method 
(attr.name);
-                                               unowned TestPlan.AsyncTestMethodResult testmethod =
-                                                        (TestPlan.AsyncTestMethodResult)assembly.get_method 
(attr.finish_real_name);
+                                               unowned TestPlan.AsyncTestMethod beginmethod = 
(TestPlan.AsyncTestMethod)assembly.get_method (attr.name);
+                                               unowned TestPlan.AsyncTestMethodResult testmethod = 
(TestPlan.AsyncTestMethodResult)assembly.get_method (attr.finish_real_name);
                                                adapter.add_async_test (beginmethod, testmethod);
                                        } catch (Error e) {
                                                var message = e.message;
@@ -193,22 +189,15 @@ public class Valadate.TestPlan : Vala.CodeVisitor {
                                        }
                                } else {
                                        try {
-                                               TestPlan.TestMethod testmethod =
-                                                        (TestPlan.TestMethod)assembly.get_method (attr.name);
+                                               TestPlan.TestMethod testmethod = 
(TestPlan.TestMethod)assembly.get_method (attr.name);
                                                adapter.add_test ((owned)testmethod);
                                        } catch (Error e) {
                                                var message = e.message;
                                                adapter.add_test_method (()=> {debug (message);});
                                        }
                                }
-                       } else {
-                               adapter.add_test_method (()=> {assert_not_reached ();});
                        }
-
-                       adapter.label = "%s/%s".printf (
-                               testcase.label,
-                               adapter.label);
-
+                       adapter.label = "%s/%s".printf (testcase.label,adapter.label);
                        testcase.add_test (adapter);
                }
 
diff --git a/valadate/testreport.vala b/valadate/testreport.vala
index d54d982..d164d59 100644
--- a/valadate/testreport.vala
+++ b/valadate/testreport.vala
@@ -43,10 +43,10 @@ public class Valadate.TestReport {
        private const string SYSTEM_OUT_TAG = "system-out";
        private const string SYSTEM_ERR_TAG = "system-err";
 
-       public Test test {get;set;}
-       public bool subprocess {get;set;}
+       public Test test { get; set; }
+       public bool subprocess { get; set; }
 
-       public XmlFile xml {get;set;}
+       public XmlFile xml { get; set; }
 
        private static int64 start_time;
        private static int64 end_time;
@@ -226,8 +226,8 @@ public class Valadate.TestReport {
                string? message)        {
 
                if (((log_levels & LogLevelFlags.LEVEL_INFO) != 0) ||
-                        ((log_levels & LogLevelFlags.LEVEL_MESSAGE) != 0) ||
-                        ((log_levels & LogLevelFlags.LEVEL_DEBUG) != 0)) {
+                       ((log_levels & LogLevelFlags.LEVEL_MESSAGE) != 0) ||
+                       ((log_levels & LogLevelFlags.LEVEL_DEBUG) != 0)) {
                        add_message (INFO_TAG, message);
                } else {
                        add_error (message);
diff --git a/valadate/testresult.vala b/valadate/testresult.vala
index cf91711..ee12889 100644
--- a/valadate/testresult.vala
+++ b/valadate/testresult.vala
@@ -22,8 +22,8 @@
 
 public class Valadate.TestResult {
 
-       public TestConfig config {get;set;}
-       public TestReportPrinter printer {get;set;}
+       public TestConfig config { get; set; }
+       public TestReportPrinter printer { get; set; }
 
        private Queue<TestReport> reports = new Queue<TestReport> ();
        private HashTable<Test, TestReport> tests = new HashTable<Test, TestReport> (direct_hash, 
direct_equal);
diff --git a/valadate/testsuite.vala b/valadate/testsuite.vala
index bb4541e..3b8310c 100644
--- a/valadate/testsuite.vala
+++ b/valadate/testsuite.vala
@@ -52,7 +52,7 @@ public class Valadate.TestSuite : Object, Test {
                        return testcount;
                }
        }
-       public Test? parent {get;set;}
+       public Test? parent { get; set; }
        /**
         * Returns a {@link GLib.List} of {@link Valadate.Test}s that will be
         * run by this TestSuite
@@ -62,11 +62,12 @@ public class Valadate.TestSuite : Object, Test {
                        return _tests;
                }
        }
-       public TestStatus status {get;set;default=TestStatus.NOT_RUN;}
-       public double time {get;set;}
-       public int skipped {get;set;}
-       public int errors {get;set;}
-       public int failures {get;set;}
+
+       public TestStatus status { get; set; default=TestStatus.NOT_RUN;}
+       public double time { get; set; }
+       public int skipped { get; set; }
+       public int errors { get; set; }
+       public int failures { get; set; }
        /**
         * The public constructor takes an optional string parameter for the
         * TestSuite's name
diff --git a/valadate/xmltestreportprinter.vala b/valadate/xmltestreportprinter.vala
index dc6e754..974e198 100644
--- a/valadate/xmltestreportprinter.vala
+++ b/valadate/xmltestreportprinter.vala
@@ -28,7 +28,7 @@ public class Valadate.XmlTestReportPrinter : TestReportPrinter {
                """<testsuites disabled="" errors="" failures="" name="" """ +
                """tests="" time=""></testsuites>""";
 
-       public XmlFile xml {get;set;}
+       public XmlFile xml { get; set; }
 
        private Xml.Node* testsuite;
        private Xml.Node* oldtestsuite;


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