aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc')
-rw-r--r--libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
index e8c15588557..2fe88f5815b 100644
--- a/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
+++ b/libstdc++-v3/testsuite/27_io/ostream_inserter_char.cc
@@ -289,6 +289,45 @@ void test07()
#endif
}
+void test08()
+{
+ bool test = true;
+ char* pt = NULL;
+
+ // 1
+ std::ostringstream oss;
+ oss << pt;
+ VERIFY( oss.bad() );
+ VERIFY( oss.str().size() == 0 );
+
+ oss.clear();
+ oss << "";
+ VERIFY( oss.good() );
+
+#if _GLIBCPP_USE_WCHAR_T
+ // 2
+ std::wostringstream woss;
+ woss << pt;
+ VERIFY( woss.bad() );
+ VERIFY( woss.str().size() == 0 );
+
+ woss.clear();
+ woss << "";
+ VERIFY( woss.good() );
+
+ // 3
+ wchar_t* wt = NULL;
+ woss.clear();
+ woss << wt;
+ VERIFY( woss.bad() );
+ VERIFY( woss.str().size() == 0 );
+
+ woss.clear();
+ woss << L"";
+ VERIFY( woss.good() );
+#endif
+}
+
int main()
{
test01();
@@ -298,5 +337,6 @@ int main()
test05();
test06();
test07();
+ test08();
return 0;
}