[vala/wip/valadate: 56/71] modified tests



commit 078ca4f4d22e3e6c7e082661703ee9934fee15d8
Author: chebizarro gmail com <chebizarro gmail com>
Date:   Fri Apr 28 10:31:57 2017 -0700

    modified tests

 tests/Makefile.am                  |   13 ++++++++++++
 tests/valadatetests.vala           |    8 +-----
 tests/valatestsfactory.vala        |   38 ++++++++++++++++++++++++++++++-----
 valadate/testreportprinter.vala    |    3 +-
 valadate/xmlfile.vala              |    3 +-
 valadate/xmltestreportprinter.vala |    3 +-
 6 files changed, 53 insertions(+), 15 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 02cfcea..87ca400 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,19 @@
 include $(top_srcdir)/Makefile.common
 include $(top_srcdir)/build-aux/glib-tap.mk
 
+AM_CPPFLAGS = \
+       $(GLIB_CFLAGS) \
+       $(NULL)
+AM_LDFLAGS = \
+       $(GLIB_LIBS) \
+       $(NULL)
+
+TESTS_ENVIRONMENT += \
+       EXEEXT=$(EXEEXT) \
+       CFLAGS='$(CFLAGS)' \
+       CPPFLAGS='$(CPPFLAGS)' \
+       LDFLAGS='$(LDFLAGS)'
+
 test_programs = valadatetests valactests@PACKAGE_SUFFIX@
 
 # Valadate tests
diff --git a/tests/valadatetests.vala b/tests/valadatetests.vala
index 4fc4de7..8f9dd94 100644
--- a/tests/valadatetests.vala
+++ b/tests/valadatetests.vala
@@ -28,12 +28,8 @@ public class Valadate.Tests.TestFixture : Valadate.TestCase {
                stdout.puts ("This is a test of the system");
        }
 
-       public void test_testcase_1 () {
-               string key = "XDG_DATA_DIRS";
-               var val = Environment.get_variable (key);
-               message ("%s = %s",key, val);
-               foreach (var item in Environment.get_system_data_dirs ())
-                       message ("%s",item);
+       public void test_testcase_1 () throws Error {
+
        }
 
        public void test_testcase_2 () {
diff --git a/tests/valatestsfactory.vala b/tests/valatestsfactory.vala
index a8d9285..090cb91 100644
--- a/tests/valatestsfactory.vala
+++ b/tests/valatestsfactory.vala
@@ -328,31 +328,57 @@ public class Vala.TestsFactory : Object {
 
        public class ValaCompiler : Program {
                private const string VALA_FLAGS =
-                       """--save-temps --disable-warnings --pkg gio-unix-2.0 --pkg config
-                         -X -lm -X -g -X -O0 -X -pipe
+                       """--save-temps --disable-warnings --pkg gio-2.0 --pkg gio-unix-2.0
+                         -X -lm -X -g -X -O0 -X -pipe -X -DGETTEXT_PACKAGE=valac
                          -X -Wno-discarded-qualifiers -X -Wno-incompatible-pointer-types
                          -X -Wno-deprecated-declarations -X -Werror=return-type
                          -X -Werror=init-self -X -Werror=implicit -X -Werror=sequence-point
                          -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 -DGETTEXT_PACKAGE="VALAC"""";
+                         -X -Werror=redundant-decls -X -Werror=int-conversion""";
 
                public ValaCompiler (File compiler) {
                        Object (program : compiler);
                }
 
                public Program compile (File binary, File sourcefile, string? parameters = null) throws Error 
{
+
+
                        if (binary.query_exists ())
                                throw new IOError.EXISTS ("binary `%s' already exists", binary.get_path ());
 
-                       string command = "--vapidir %s %s %s -o %s %s".printf (
-                               vapidir.get_path (), VALA_FLAGS, parameters ?? "", binary.get_path (), 
sourcefile.get_path ());
+                       string command = "--vapidir %s %s %s %s -o %s %s".printf (
+                               vapidir.get_path (),
+                               VALA_FLAGS,
+                               get_flags(),
+                               parameters ?? "", binary.get_path (),
+                               sourcefile.get_path ());
                        run (command);
                        var prog = new TestProgram (binary);
                        prog.add_file (binary.get_parent().get_child (binary.get_basename () + ".c"));
                        return prog;
                }
+               
+               private string get_flags() throws Error {
+                       
+                       string result = "";
+                       string[] flags = {"CFLAGS", "CPPFLAGS", "LDFLAGS"};
+                       
+                       foreach(string key in flags) {
+                               var val = Environment.get_variable (key);
+                               if(val == null || val.length == 0)
+                                       continue;
+
+                               string[] args;
+                               Shell.parse_argv(val, out args);
+
+                               foreach (var item in args)
+                                       result += "-X %s ".printf(item);
+                       }
+                       
+                       return result;
+               }
+               
        }
 }
diff --git a/valadate/testreportprinter.vala b/valadate/testreportprinter.vala
index 5ddaaf0..71c8ed8 100644
--- a/valadate/testreportprinter.vala
+++ b/valadate/testreportprinter.vala
@@ -17,7 +17,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA 02110-1301, USA.
  * 
- * 
+ * Authors:
+ *     Chris Daley <chebizarro gmail com>
  */
 
 public abstract class Valadate.TestReportPrinter {
diff --git a/valadate/xmlfile.vala b/valadate/xmlfile.vala
index ca76e17..682f6a2 100644
--- a/valadate/xmlfile.vala
+++ b/valadate/xmlfile.vala
@@ -16,7 +16,8 @@
  * along with this program; 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>
  */
 
 public errordomain Valadate.XmlFileError {
diff --git a/valadate/xmltestreportprinter.vala b/valadate/xmltestreportprinter.vala
index 3ae7c3a..e389c7d 100644
--- a/valadate/xmltestreportprinter.vala
+++ b/valadate/xmltestreportprinter.vala
@@ -17,7 +17,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA 02110-1301, USA.
  * 
- * 
+ * Authors:
+ *     Chris Daley <chebizarro gmail com>
  */
 
 public class Valadate.XmlTestReportPrinter : TestReportPrinter {


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