[libcxx] r258279 - Fix up the tests I added for string exceptions to be skipped when exceptions are disabled

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 19:19:15 PST 2016


Author: marshall
Date: Tue Jan 19 21:19:15 2016
New Revision: 258279

URL: http://llvm.org/viewvc/llvm-project?rev=258279&view=rev
Log:
Fix up the tests I added for string exceptions to be skipped when exceptions are disabled

Modified:
    libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
    libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
    libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
    libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
    libcxx/trunk/test/support/test_iterators.h

Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp?rev=258279&r1=258278&r2=258279&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp Tue Jan 19 21:19:15 2016
@@ -161,6 +161,7 @@ int main()
          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 @@ int main()
     test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
     test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
 	}
+#endif
 }

Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp?rev=258279&r1=258278&r2=258279&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/iterator.pass.cpp Tue Jan 19 21:19:15 2016
@@ -161,6 +161,7 @@ int main()
          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 @@ int main()
     test_exceptions(S(), TIter(s, s+10, 5, TIter::TADereference), TIter());
     test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
 	}
+#endif
 }

Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp?rev=258279&r1=258278&r2=258279&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_insert/iter_iter_iter.pass.cpp Tue Jan 19 21:19:15 2016
@@ -142,6 +142,7 @@ int main()
          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 @@ int main()
     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;

Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp?rev=258279&r1=258278&r2=258279&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_replace/iter_iter_iter_iter.pass.cpp Tue Jan 19 21:19:15 2016
@@ -990,6 +990,7 @@ int main()
     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 @@ int main()
     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
 }

Modified: libcxx/trunk/test/support/test_iterators.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_iterators.h?rev=258279&r1=258278&r2=258279&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_iterators.h (original)
+++ libcxx/trunk/test/support/test_iterators.h Tue Jan 19 21:19:15 2016
@@ -349,7 +349,12 @@ struct ThrowingIterator {
 	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 @@ struct ThrowingIterator {
 	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 @@ struct ThrowingIterator {
 	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 @@ struct ThrowingIterator {
 	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 @@ struct ThrowingIterator {
 	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_;
 	}




More information about the cfe-commits mailing list