[vala/wip/valadate: 121/137] more changes
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/valadate: 121/137] more changes
- Date: Thu, 10 Nov 2016 17:28:39 +0000 (UTC)
commit 5a07c5f5d109f5173b59c707745225a7ec8f948e
Author: Chris Daley <chebizarro gmail com>
Date: Tue Jul 19 23:12:51 2016 -0400
more changes
valadate/Makefile.am | 2 --
valadate/testcase.vala | 35 +++--------------------------------
valadate/testconfig.vala | 2 +-
valadate/testexplorer.vala | 5 ++++-
valadate/testfailure.vala | 2 +-
valadate/testresult.vala | 6 +++---
valadate/testsuite.vala | 34 ++++++++++++++++++++++++++++++++--
7 files changed, 44 insertions(+), 42 deletions(-)
---
diff --git a/valadate/Makefile.am b/valadate/Makefile.am
index 301998a..06a2d20 100644
--- a/valadate/Makefile.am
+++ b/valadate/Makefile.am
@@ -9,7 +9,6 @@ libvaladate_la_SOURCES = \
assembly.vala \
module.vala \
tap.vala \
- tapresult.vala \
test.vala \
testcase.vala \
testconfig.vala \
@@ -17,7 +16,6 @@ libvaladate_la_SOURCES = \
testfixture.vala \
testresult.vala \
testfailure.vala \
- testresultfactory.vala \
testrunner.vala \
testsuite.vala \
$(NULL)
diff --git a/valadate/testcase.vala b/valadate/testcase.vala
index b2eb212..1e2107c 100644
--- a/valadate/testcase.vala
+++ b/valadate/testcase.vala
@@ -53,7 +53,6 @@ public abstract class Valadate.TestCase : Object, Test, TestFixture {
result.run(this);
- return result;
}
@@ -69,34 +68,6 @@ public abstract class Valadate.TestCase : Object, Test, TestFixture {
- private HashTable<string, TestAdaptor> _tests =
- new HashTable<string, TestAdaptor> (str_hash, str_equal);
-
-
- private class TestAdaptor : Object, Test {
-
- public string name { get; set; }
-
- private Test.TestMethod test;
-
- public TestAdaptor(string name, owned Test.TestMethod test) {
- this.name = name;
- this.test = (owned)test;
- }
-
- public TestResult? run(TestResult? result = null) {
- this.test();
- return result;
- }
-
- }
-
- public void add_test (string name, owned Test.TestMethod test)
- requires (name.contains("/") != true)
- {
- var adaptor = new TestAdaptor (name, (owned)test);
- _tests.insert(name, adaptor);
- }
@@ -138,7 +109,7 @@ public abstract class Valadate.TestCase : Object, Test, TestFixture {
name = this.get_type().name();
}
- public void add_testb (string name, owned Test.TestMethod test)
+ public void add_testb (string name, owned TestSuite.TestMethod test)
requires (name.contains("/") != true)
{
var adaptor = new Adaptor (name, (owned)test, this);
@@ -186,7 +157,7 @@ public abstract class Valadate.TestCase : Object, Test, TestFixture {
public string name { get; private set; }
public int async_timeout { get; set; }
- private Test.TestMethod test;
+ private TestSuite.TestMethod test;
private TestCase test_case;
public bool is_async = false;
@@ -194,7 +165,7 @@ public abstract class Valadate.TestCase : Object, Test, TestFixture {
public AsyncFinish async_finish;
public Adaptor (string name,
- owned Test.TestMethod test,
+ owned TestSuite.TestMethod test,
TestCase test_case) {
this.name = name;
this.test = (owned)test;
diff --git a/valadate/testconfig.vala b/valadate/testconfig.vala
index ed66d3d..e51b19d 100644
--- a/valadate/testconfig.vala
+++ b/valadate/testconfig.vala
@@ -126,7 +126,7 @@ public class Valadate.TestConfig : Object {
GLib.Random.next_int(),
GLib.Random.next_int());
- result = TestResultFactory.get_instance().new_for_type(format);
+ result = new TestResult();
try {
load();
diff --git a/valadate/testexplorer.vala b/valadate/testexplorer.vala
index bb9bedd..d51885f 100644
--- a/valadate/testexplorer.vala
+++ b/valadate/testexplorer.vala
@@ -96,7 +96,10 @@ internal class Valadate.TestExplorer : Vala.CodeVisitor {
}
public override void visit_namespace(Vala.Namespace ns) {
- ns.accept_children(this);
+
+ if (ns.name != "GLib")
+ ns.accept_children(this);
+
}
diff --git a/valadate/testfailure.vala b/valadate/testfailure.vala
index 14f645a..1444cdf 100644
--- a/valadate/testfailure.vala
+++ b/valadate/testfailure.vala
@@ -21,7 +21,7 @@
*/
public class Valadate.TestFailure : Object {
- public unowned Test failed_test {get;private set;}
+ public unowned Test test {get;private set;}
public string message {get;private set;}
diff --git a/valadate/testresult.vala b/valadate/testresult.vala
index 2eae581..ba077c7 100644
--- a/valadate/testresult.vala
+++ b/valadate/testresult.vala
@@ -52,12 +52,12 @@ public class Valadate.TestResult : Object {
}
public void add_error(Test test, string error) {
- errors.append(new TestFailure(test, error);
+ errors.append(new TestFailure(test, error));
test_error(test, error);
}
public void add_failure(Test test, string failure) {
- failures.append(new TestFailure(test, failure);
+ failures.append(new TestFailure(test, failure));
test_failure(test, failure);
}
@@ -73,7 +73,7 @@ public class Valadate.TestResult : Object {
test_start(test);
- test.run();
+ test.run(this);
test_complete(test);
}
diff --git a/valadate/testsuite.vala b/valadate/testsuite.vala
index c041c31..8a7e85e 100644
--- a/valadate/testsuite.vala
+++ b/valadate/testsuite.vala
@@ -32,6 +32,8 @@ public class Valadate.TestSuite : Object, Test {
private HashTable<string, Test> _tests =
new HashTable<string, Test> (str_hash, str_equal);
+ private List<weak Test> _values;
+
/**
* the name of the TestSuite
*/
@@ -53,7 +55,8 @@ public class Valadate.TestSuite : Object, Test {
*/
public List<weak Test> tests {
get {
- return _tests.get_values();
+ _values = _tests.get_values();
+ return _values;
}
}
@@ -72,6 +75,12 @@ public class Valadate.TestSuite : Object, Test {
_tests.set(name, test);
}
+ public void add_test_method(string name, owned TestMethod test) {
+ var adaptor = new TestAdaptor ((owned)test);
+ _tests.set(name, adaptor);
+ }
+
+
public void run(TestResult result) {
_tests.foreach((k,t) => { run_test(t, result); });
}
@@ -84,8 +93,29 @@ public class Valadate.TestSuite : Object, Test {
return _tests.lookup(name);
}
- public void set(string name, Test test) {
+ public new void set(string name, Test test) {
_tests.set(name, test);
}
+ private class TestAdaptor : Object, Test {
+
+ private TestSuite.TestMethod test;
+
+ public int count {
+ get {
+ return 1;
+ }
+ }
+
+ public TestAdaptor(owned TestSuite.TestMethod test) {
+ this.test = (owned)test;
+ }
+
+ public void run(TestResult test) {
+ this.test();
+ }
+
+ }
+
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]