Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 #include <stdio.h>
3 #include <algorithm>
4 #ifndef mozilla_algorithm_h
5 # error "failed to wrap <algorithm>"
6 #endif
8 #include <vector>
9 #ifndef mozilla_vector_h
10 # error "failed to wrap <vector>"
11 #endif
13 // gcc errors out if we |try ... catch| with -fno-exceptions, but we
14 // can still test on windows
15 #ifdef _MSC_VER
16 // C4530 will be generated whenever try...catch is used without
17 // enabling exceptions. We know we don't enbale exceptions.
18 # pragma warning( disable : 4530 )
19 # define TRY try
20 # define CATCH(e) catch (e)
21 #else
22 # define TRY
23 # define CATCH(e) if (0)
24 #endif
26 int main() {
27 std::vector<int> v;
28 int rv = 1;
30 TRY {
31 // v.at(1) on empty v should abort; NOT throw an exception
33 // (Do some arithmetic with result of v.at() to avoid
34 // compiler warnings for unused variable/result.)
35 rv += v.at(1) ? 1 : 2;
36 } CATCH(const std::out_of_range&) {
37 fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception?\n",
38 stderr);
39 return 1;
40 }
42 fputs("TEST-FAIL | TestSTLWrappers.cpp | didn't abort()?\n",
43 stderr);
44 return rv;
45 }