[glibmm] tests/glibmm_buildfilename: Add some tests



commit d6e9d60d3af2d77a2dbffb102eaf9b0e2c0252e2
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Fri Mar 20 16:30:29 2020 +0100

    tests/glibmm_buildfilename: Add some tests
    
    See issue #71

 README                             |  2 +-
 tests/glibmm_buildfilename/main.cc | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/README b/README
index b6417674..51f662ee 100644
--- a/README
+++ b/README
@@ -33,7 +33,7 @@ files used by Autotools.
   $ cd your_builddir
 
 If the tarball was made with Autotools, you must enable maintainer-mode:
-  $ meson configure -Dmaintainer-mode=yes
+  $ meson configure -Dmaintainer-mode=true
 
 Then, regardless of how the tarball was made:
   $ ninja
diff --git a/tests/glibmm_buildfilename/main.cc b/tests/glibmm_buildfilename/main.cc
index 2460622b..09a5929f 100644
--- a/tests/glibmm_buildfilename/main.cc
+++ b/tests/glibmm_buildfilename/main.cc
@@ -1,6 +1,7 @@
 #include <glibmm.h>
 #include <iostream>
 #include <string.h>
+#include <vector>
 
 // Use this line if you want debug output:
 // std::ostream& ostr = std::cout;
@@ -39,5 +40,29 @@ main(int, char**)
   path = Glib::build_filename(dir_1, dir_2, dir_1, dir_3, dir_2, dir_3, dir_1, dir_2, file_2);
   ostr << "Path 5: " << path << std::endl;
 
+  path = Glib::build_filename(dir_2, file_2);
+  ostr << "Path 6: " << path << std::endl;
+
+  path = Glib::build_filename(dir_2, file_3);
+  ostr << "Path 7: " << path << std::endl;
+
+  path = Glib::build_filename(dir_3, file_3);
+  ostr << "Path 8: " << path << std::endl;
+
+  path = Glib::build_filename(dir_1);
+  ostr << "Path 9: " << path << std::endl;
+
+  path = Glib::build_filename(nullptr);
+  ostr << "Path 10: " << path << std::endl;
+
+  std::vector<std::string> pathv;
+  pathv.push_back("vdir1");
+  path = Glib::build_filename(pathv);
+  ostr << "Path v1: " << path << std::endl;
+
+  pathv.push_back("vdir2");
+  path = Glib::build_filename(pathv);
+  ostr << "Path v2: " << path << std::endl;
+
   return EXIT_SUCCESS;
 }


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