[vala/wip/valadate: 732/749] modified tests



commit c187fc8d77c1c1cf5d937fd1929e8a415d7d6fde
Author: chebizarro gmail com <chebizarro gmail com>
Date:   Fri Apr 28 06:28:47 2017 -0700

    modified tests

 tests/dbus/filedescriptor-errors.test         |    4 ++--
 tests/methods/bug642350.vala                  |    2 ++
 tests/methods/printf-constructor-invalid.test |    2 +-
 tests/methods/printf-invalid.test             |    2 +-
 tests/valatests.vala                          |   15 +++++++++++++--
 tests/valatestsfactory.vala                   |    7 ++++---
 valadate/testcase.vala                        |    3 +--
 valadate/testconfig.vala                      |    6 ++++++
 valadate/testoptions.vala                     |    6 ++++++
 valadate/testreport.vala                      |   12 ------------
 valadate/testrunner.vala                      |    2 +-
 11 files changed, 37 insertions(+), 24 deletions(-)
---
diff --git a/tests/dbus/filedescriptor-errors.test b/tests/dbus/filedescriptor-errors.test
index 96f28cf..33a2e5d 100644
--- a/tests/dbus/filedescriptor-errors.test
+++ b/tests/dbus/filedescriptor-errors.test
@@ -8,7 +8,7 @@ interface Test : Object {
        public abstract string test (UnixOutputStream output_stream) throws IOError;
 }
 
-void pipe (out UnixInputStream input, out UnixOutputStream output) throws IOError {
+void pipef (out UnixInputStream input, out UnixOutputStream output) throws IOError {
        int pipefd[2];
        if (Posix.pipe (pipefd) < 0) {
                throw new IOError.FAILED ("Pipe creation failed");
@@ -23,7 +23,7 @@ void main () {
 
        UnixInputStream i;
        UnixOutputStream o;
-       pipe (out i, out o);
+       pipef (out i, out o);
 
        try {
                test.test (o);
diff --git a/tests/methods/bug642350.vala b/tests/methods/bug642350.vala
index e2edffb..712f383 100644
--- a/tests/methods/bug642350.vala
+++ b/tests/methods/bug642350.vala
@@ -1,3 +1,5 @@
+[CCode(cname="GETTEXT_PACKAGE")]
+extern const string GETTEXT_PACKAGE;
 const string[] FOO = { N_ ("foo"), NC_ ("valac", "bar") };
 const string BAZ = N_ ("bar");
 
diff --git a/tests/methods/printf-constructor-invalid.test b/tests/methods/printf-constructor-invalid.test
index b889514..3957386 100644
--- a/tests/methods/printf-constructor-invalid.test
+++ b/tests/methods/printf-constructor-invalid.test
@@ -1,4 +1,4 @@
-SKIP Invalid Code
+Invalid Code
 
 void main () {
        var err = new Error (Quark.from_string ("g-io-error-quark"), 0, "%s", 4);
diff --git a/tests/methods/printf-invalid.test b/tests/methods/printf-invalid.test
index c05d4bb..f11ed27 100644
--- a/tests/methods/printf-invalid.test
+++ b/tests/methods/printf-invalid.test
@@ -1,4 +1,4 @@
-SKIP Invalid Code
+Invalid Code
 
 void main () {
        var s = "%s".printf (4);
diff --git a/tests/valatests.vala b/tests/valatests.vala
index 0fec7fa..9e4cbd2 100644
--- a/tests/valatests.vala
+++ b/tests/valatests.vala
@@ -23,7 +23,7 @@ public class Vala.Tests : Valadate.TestSuite {
 
        construct {
                try {
-                       var testdir = File.new_for_path (GLib.Environment.get_current_dir ());
+                       var testdir = File.new_for_path (GLib.Environment.get_variable("G_TEST_BUILDDIR"));
                        var testpath = Valadate.TestOptions.get_current_test_path ();
                        
                        if (testpath != null) {
@@ -35,8 +35,19 @@ public class Vala.Tests : Valadate.TestSuite {
                                        add_test (new ValaTest (runtest));
                        } else {
                                var tempdir = testdir.get_child (".tests");
-                               if (!tempdir.query_exists())
+                               if (tempdir.query_exists()) {
+                                       var enumerator = tempdir.enumerate_children 
(FileAttribute.STANDARD_NAME, 0);
+                                       FileInfo file_info;
+                                       while ((file_info = enumerator.next_file ()) != null) {
+                                               var filename = file_info.get_name();
+                                               if(filename == "." || filename == "..")
+                                                       continue;
+                                               var tfile = tempdir.get_child(file_info.get_name());
+                                               tfile.delete();
+                                       }
+                               } else {
                                        tempdir.make_directory();
+                               }
 
                                var enumerator = testdir.enumerate_children (FileAttribute.STANDARD_NAME, 0);
                                FileInfo file_info;
diff --git a/tests/valatestsfactory.vala b/tests/valatestsfactory.vala
index 24e2092..a8d9285 100644
--- a/tests/valatestsfactory.vala
+++ b/tests/valatestsfactory.vala
@@ -29,7 +29,7 @@ public class Vala.TestsFactory : Object {
        static File vapidir;
 
        class construct {
-               currdir = File.new_for_path (GLib.Environment.get_current_dir());
+               currdir = File.new_for_path (GLib.Environment.get_variable("G_TEST_BUILDDIR"));
                testdir = currdir.get_child (".tests");
                buildir = currdir.get_parent ();
 
@@ -328,7 +328,7 @@ public class Vala.TestsFactory : Object {
 
        public class ValaCompiler : Program {
                private const string VALA_FLAGS =
-                       """--save-temps --disable-warnings --pkg gio-2.0 
+                       """--save-temps --disable-warnings --pkg gio-unix-2.0 --pkg config
                          -X -lm -X -g -X -O0 -X -pipe
                          -X -Wno-discarded-qualifiers -X -Wno-incompatible-pointer-types
                          -X -Wno-deprecated-declarations -X -Werror=return-type
@@ -336,7 +336,8 @@ public class Vala.TestsFactory : Object {
                          -X -Werror=return-type -X -Werror=uninitialized -X -Werror=pointer-arith
                          -X -Werror=int-to-pointer-cast -X -Werror=pointer-to-int-cast
                          -X -Wformat -X -Werror=format-security -X -Werror=format-nonliteral
-                         -X -Werror=redundant-decls""";
+                         -X -Werror=redundant-decls
+                         -X -DGETTEXT_PACKAGE="VALAC"""";
 
                public ValaCompiler (File compiler) {
                        Object (program : compiler);
diff --git a/valadate/testcase.vala b/valadate/testcase.vala
index fc2e52d..717d879 100644
--- a/valadate/testcase.vala
+++ b/valadate/testcase.vala
@@ -2,7 +2,7 @@
  * Valadate - Unit testing library for GObject-based libraries.
  *
  * testcase.vala
- * Copyright (C) 2016 Chris Daley
+ * Copyright (C) 2016-2017 Chris Daley
  * Copyright (C) 2009-2012 Julien Peeters
  *
  * This library is free software; you can redistribute it and/or
@@ -116,7 +116,6 @@ public abstract class Valadate.TestCase : Object, Test {
 
        public void skip(string message) {
                current_result.add_skip(current_test, message);
-
        }
 
        public void fail(string? message = null) {
diff --git a/valadate/testconfig.vala b/valadate/testconfig.vala
index 6ed1d35..a7405db 100644
--- a/valadate/testconfig.vala
+++ b/valadate/testconfig.vala
@@ -43,6 +43,12 @@ public class Valadate.TestConfig {
                }
        }
 
+       public string[] testpaths {
+               get {
+                       return options.testpaths;
+               }
+       }
+
        public string? running_test {
                get {
                        return options.running_test;
diff --git a/valadate/testoptions.vala b/valadate/testoptions.vala
index c627c69..1cffd54 100644
--- a/valadate/testoptions.vala
+++ b/valadate/testoptions.vala
@@ -112,6 +112,12 @@ public class Valadate.TestOptions {
                }
        }
 
+       public string[] testpaths {
+               get {
+                       return _paths;
+               }
+       }
+
        public TestOptions(string[] args) throws OptionError {
                _runtest = null;
 
diff --git a/valadate/testreport.vala b/valadate/testreport.vala
index 8e4dc73..f5e58f6 100644
--- a/valadate/testreport.vala
+++ b/valadate/testreport.vala
@@ -84,18 +84,6 @@ public class Valadate.TestReport {
                root->set_prop("tests", test.count.to_string());
                root->set_prop("name",test.label);
                xml = new XmlFile.from_doc(doc);
-               
-               if(test.parent != null && test.parent.name != "/")
-                       return;
-               
-               var props = root->children;
-               
-               foreach(var key in Environment.list_variables()) {
-                       Xml.Node* node = new Xml.Node(null, "property");
-                       node->set_prop("name", key);
-                       node->set_prop("value", Markup.escape_text(Environment.get_variable(key)));
-                       props->add_child(node);
-               }
        }
 
        private void new_testcase() throws Error {
diff --git a/valadate/testrunner.vala b/valadate/testrunner.vala
index 2576cc3..6635499 100644
--- a/valadate/testrunner.vala
+++ b/valadate/testrunner.vala
@@ -28,7 +28,7 @@ public class Valadate.TestRunner {
 
        private uint _n_ongoing_tests = 0;
        private Queue<DelegateWrapper> _pending_tests = new Queue<DelegateWrapper> ();
-       private static uint _max_n_ongoing_tests = GLib.get_num_processors();
+       private static uint _max_n_ongoing_tests = GLib.get_num_processors() * 2;
        private MainLoop loop;
        private TestPlan plan;
        


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