Bug 551254: Simple (disabled) test that the STL wrappers work correctly.
☠☠ backed out by 6cf5a3399c7a ☠ ☠
authorChris Jones <jones.chris.g@gmail.com>
Fri, 02 Apr 2010 12:58:12 -0500
changeset 40154 ac5cbcb2feb238b2985b125dd7b178c66df18643
parent 40153 cec7b12eb5e30a59bc9c621662fbe192000411f9
child 40155 146fdb589df554ded5107b01acd4048f8c70f913
child 40156 6cf5a3399c7a0f8c26ec0ea1db069eaed0398408
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs551254
milestone1.9.3a4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 551254: Simple (disabled) test that the STL wrappers work correctly.
xpcom/tests/Makefile.in
xpcom/tests/TestSTLWrappers.cpp
--- a/xpcom/tests/Makefile.in
+++ b/xpcom/tests/Makefile.in
@@ -68,16 +68,20 @@ CPPSRCS		= \
 		TestTimers.cpp \
 		TestOOM.cpp \
 		TestBlockingProcess.cpp \
 		TestQuickReturn.cpp \
 		TestArguments.cpp \
 		TestUnicodeArguments.cpp \
 		$(NULL)
 
+ifdef WRAP_STL_INCLUDES
+CPPSRCS += TestSTLWrappers.cpp
+endif
+
 SIMPLE_PROGRAMS	:= $(CPPSRCS:.cpp=$(BIN_SUFFIX))
 
 CPP_UNIT_TESTS = \
                  ShowSSEConfig.cpp \
                  TestAutoPtr.cpp \
                  TestCOMArray.cpp \
                  TestCOMPtr.cpp \
                  TestCOMPtrEq.cpp \
new file mode 100644
--- /dev/null
+++ b/xpcom/tests/TestSTLWrappers.cpp
@@ -0,0 +1,35 @@
+#include <stdio.h>
+
+#include <algorithm>
+#ifndef mozilla_algorithm_h
+#  error "failed to wrap <algorithm>"
+#endif
+
+#include <vector>
+#ifndef mozilla_vector_h
+#  error "failed to wrap <vector>"
+#endif
+
+// gcc errors out if we |try ... catch| with -fno-exceptions, but we
+// can still test on windows
+#ifdef XP_WIN
+#  define TRY       try
+#  define CATCH(e)  catch (e)
+#else
+#  define TRY
+#  define CATCH(e)  if (0)
+#endif
+
+int main() {
+    std::vector<int> v;
+
+    TRY {
+      // this should abort; NOT throw an exception
+      int unused = v.at(1);
+    } CATCH(const std::out_of_range& e) {
+      fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception!\n",
+            stderr);
+    }
+
+    return 0;
+}