Fix up the tests I added for string exceptions to be skipped when exceptions are disabled

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@258279 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
index 82e6fb5..d0e3459 100644
--- a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
@@ -161,6 +161,7 @@
          S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
     }
 #endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
 	{ // test iterator operations that throw
     typedef std::string S;
     typedef ThrowingIterator<char> TIter;
@@ -174,4 +175,5 @@
     test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
     test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
 	}
+#endif
 }
diff --git a/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
index 690aebd..de43b40 100644
--- a/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
@@ -161,6 +161,7 @@
          S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
     }
 #endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
 	{ // test iterator operations that throw
     typedef std::string S;
     typedef ThrowingIterator<char> TIter;
@@ -174,4 +175,5 @@
     test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
     test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
 	}
+#endif
 }
diff --git a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
index 4c29ab4..3128569 100644
--- a/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
@@ -142,6 +142,7 @@
          S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
     }
 #endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
 	{ // test iterator operations that throw
     typedef std::string S;
     typedef ThrowingIterator<char> TIter;
@@ -155,6 +156,7 @@
     test_exceptions(S(), 0, TIter(s, s+10, 5, TIter::TADereference), TIter());
     test_exceptions(S(), 0, TIter(s, s+10, 6, TIter::TAComparison), TIter());
 	}
+#endif
 #if _LIBCPP_DEBUG >= 1
     {
         std::string v;
diff --git a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
index 0579641..60f2e3f 100644
--- a/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
+++ b/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
@@ -990,6 +990,7 @@
     test8<S>();
     }
 #endif
+#ifndef TEST_HAS_NO_EXCEPTIONS
 	{ // test iterator operations that throw
     typedef std::string S;
     typedef ThrowingIterator<char> TIter;
@@ -1003,4 +1004,5 @@
     test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 5, TIter::TADereference), TIter());
     test_exceptions(S("abcdefghijklmnopqrst"), 10, 5, TIter(s, s+10, 6, TIter::TAComparison), TIter());
 	}
+#endif
 }
diff --git a/test/support/test_iterators.h b/test/support/test_iterators.h
index d814879..929c18b 100644
--- a/test/support/test_iterators.h
+++ b/test/support/test_iterators.h
@@ -349,7 +349,12 @@
 	if (action_ == TAAssignment)
 	{
 		if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+			assert(false);
+#else
 			throw std::runtime_error ("throw from iterator assignment");
+#endif
+
 		else
 			--index_;
 	}
@@ -367,7 +372,11 @@
 	if (action_ == TADereference)
 	{
 		if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+			assert(false);
+#else
 			throw std::runtime_error ("throw from iterator dereference");
+#endif
 		else
 			--index_;
 	}
@@ -379,7 +388,11 @@
 	if (action_ == TAIncrement)
 	{
 		if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+			assert(false);
+#else
 			throw std::runtime_error ("throw from iterator increment");
+#endif
 		else
 			--index_;
 	}
@@ -399,7 +412,11 @@
 	if (action_ == TADecrement)
 	{
 		if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+			assert(false);
+#else
 			throw std::runtime_error ("throw from iterator decrement");
+#endif
 		else
 			--index_;
 	}
@@ -418,7 +435,11 @@
 	if (action_ == TAComparison)
 	{
 		if (index_ == 0)
+#ifndef TEST_HAS_NO_EXCEPTIONS
+			assert(false);
+#else
 			throw std::runtime_error ("throw from iterator comparison");
+#endif
 		else
 			--index_;
 	}