[glibmm] Add regression test for Bug #613250.



commit 00f67118a394e743de6b87338397f2e833260495
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Mar 26 10:41:24 2010 +0100

    Add regression test for Bug #613250.
    
        * tests/Makefile.am
        * tests/glibmm_ustring_format/main.cc: Added a regression test for the
        previously-commited fix, based on code in bug #613250 from Debarshi Ray.

 ChangeLog                           |    8 ++++++++
 gio/src/gio_enums.defs              |    3 ++-
 tests/Makefile.am                   |    4 +++-
 tests/glibmm_ustring_format/main.cc |   28 ++++++++++++++++++++++++++++
 4 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fdc2dfd..49f7dd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-26  Murray Cumming  <murrayc murrayc com>
+
+    Add regression test for Bug #613250.
+
+    * tests/Makefile.am
+	* tests/glibmm_ustring_format/main.cc: Added a regression test for the
+    previously-commited fix, based on code in bug #613250 from Debarshi Ray.
+
 2010-03-20  Debarshi Ray  <debarshir src gnome org>
 
 	Bug #613250 - Overload Glib::ustring::FormatStream::stream for char *.
diff --git a/gio/src/gio_enums.defs b/gio/src/gio_enums.defs
index 2c2e4a0..accf1bc 100644
--- a/gio/src/gio_enums.defs
+++ b/gio/src/gio_enums.defs
@@ -405,6 +405,7 @@
   (values
     '("failed" "G_IO_ERROR_FAILED" "0")
     '("not-found" "G_IO_ERROR_NOT_FOUND" "1")
+
     '("exists" "G_IO_ERROR_EXISTS" "2")
     '("is-directory" "G_IO_ERROR_IS_DIRECTORY" "3")
     '("not-directory" "G_IO_ERROR_NOT_DIRECTORY" "4")
@@ -432,6 +433,7 @@
     '("busy" "G_IO_ERROR_BUSY" "26")
     '("would-block" "G_IO_ERROR_WOULD_BLOCK" "27")
     '("host-not-found" "G_IO_ERROR_HOST_NOT_FOUND" "28")
+    '("host-not-found" "G_IO_ERROR_HOST_WAS_NOT_FOUND" "28")
     '("would-merge" "G_IO_ERROR_WOULD_MERGE" "29")
     '("failed-handled" "G_IO_ERROR_FAILED_HANDLED" "30")
     '("too-many-open-files" "G_IO_ERROR_TOO_MANY_OPEN_FILES" "31")
@@ -648,4 +650,3 @@
     '("raw" "G_ZLIB_COMPRESSOR_FORMAT_RAW" "2")
   )
 )
-
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c9c0265..cb03236 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,8 +25,9 @@ check_PROGRAMS =			\
 	glibmm_date/test		\
 	glibmm_nodetree/test		\
 	glibmm_ustring_compose/test	\
+	glibmm_ustring_format/test	\
 	glibmm_value/test		\
-	glibmm_valuearray/test		
+	glibmm_valuearray/test
 
 glibmm_includes = -I$(top_builddir)/glib $(if $(srcdir:.=),-I$(top_srcdir)/glib)
 giomm_includes  = -I$(top_builddir)/gio $(if $(srcdir:.=),-I$(top_srcdir)/gio)
@@ -54,5 +55,6 @@ glibmm_btree_test_SOURCES           = glibmm_btree/main.cc
 glibmm_date_test_SOURCES            = glibmm_date/main.cc
 glibmm_nodetree_test_SOURCES        = glibmm_nodetree/main.cc
 glibmm_ustring_compose_test_SOURCES = glibmm_ustring_compose/main.cc
+glibmm_ustring_format_test_SOURCES = glibmm_ustring_format/main.cc
 glibmm_value_test_SOURCES           = glibmm_value/glibmm_value.cc glibmm_value/main.cc
 glibmm_valuearray_test_SOURCES      = glibmm_valuearray/main.cc
diff --git a/tests/glibmm_ustring_format/main.cc b/tests/glibmm_ustring_format/main.cc
new file mode 100644
index 0000000..1d5dc92
--- /dev/null
+++ b/tests/glibmm_ustring_format/main.cc
@@ -0,0 +1,28 @@
+#include <glibmm.h>
+
+#include <iostream>
+
+int main(int, char**)
+{
+  Glib::init();
+
+  char carr[10] = "Užduotys";
+  char * const cptr = carr;
+
+  std::wostringstream wsout;
+  wsout << carr;
+  const std::wstring& wstr = wsout.str();
+  const gunichar * const data = reinterpret_cast<const gunichar *>(
+                                  wstr.data());
+
+  //for(int i = 0; wstr.size() > i; ++i)
+  //  std::cout << data[i] << std::endl;
+
+  //Check both the const char* and char* versions.
+  Glib::ustring::format(carr);
+
+  //This threw an exception before we added a ustring::FormatStream::stream(char*) overload.
+  Glib::ustring::format(cptr);
+
+  return 0;
+}



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