зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1316437 - Convert TestSTLWrappers to a gtest. r=bsmedberg
MozReview-Commit-ID: HRmnWvxyNP --HG-- rename : xpcom/tests/TestSTLWrappers.cpp => xpcom/tests/gtest/TestSTLWrappers.cpp
This commit is contained in:
Родитель
59b65be14f
Коммит
a79e2262d5
|
@ -10,6 +10,12 @@
|
|||
# error "failed to wrap <vector>"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsICrashReporter.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#endif
|
||||
|
||||
// gcc errors out if we |try ... catch| with -fno-exceptions, but we
|
||||
// can still test on windows
|
||||
#ifdef _MSC_VER
|
||||
|
@ -23,7 +29,25 @@
|
|||
# define CATCH(e) if (0)
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
extern unsigned int _gdb_sleep_duration;
|
||||
#endif
|
||||
|
||||
void ShouldAbort()
|
||||
{
|
||||
#if defined(XP_UNIX)
|
||||
_gdb_sleep_duration = 0;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
nsCOMPtr<nsICrashReporter> crashreporter =
|
||||
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
|
||||
if (crashreporter) {
|
||||
crashreporter->SetEnabled(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<int> v;
|
||||
int rv = 1;
|
||||
|
||||
|
@ -36,10 +60,19 @@ int main() {
|
|||
} CATCH(const std::out_of_range&) {
|
||||
fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception?\n",
|
||||
stderr);
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
fputs("TEST-FAIL | TestSTLWrappers.cpp | didn't abort()?\n",
|
||||
stderr);
|
||||
return rv;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
TEST(STLWrapper, DISABLED_ShouldAbortDeathTest)
|
||||
#else
|
||||
TEST(STLWrapper, ShouldAbortDeathTest)
|
||||
#endif
|
||||
{
|
||||
ASSERT_DEATH(ShouldAbort(), "terminate called after throwing an instance of 'std::out_of_range'|vector::_M_range_check");
|
||||
}
|
|
@ -56,6 +56,11 @@ if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT') and CONFIG['OS_TAR
|
|||
'TestDeadlockDetectorScalability.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['WRAP_STL_INCLUDES'] and not CONFIG['CLANG_CL']:
|
||||
UNIFIED_SOURCES += [
|
||||
'TestSTLWrappers.cpp',
|
||||
]
|
||||
|
||||
# Compile TestAllocReplacement separately so Windows headers don't pollute
|
||||
# the global namespace for other files.
|
||||
SOURCES += [
|
||||
|
|
|
@ -27,11 +27,6 @@ SimplePrograms([
|
|||
'TestUnicodeArguments',
|
||||
])
|
||||
|
||||
if CONFIG['WRAP_STL_INCLUDES'] and not CONFIG['CLANG_CL']:
|
||||
GeckoSimplePrograms([
|
||||
'TestSTLWrappers',
|
||||
])
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
|
||||
|
||||
# FIXME: bug 577500 TestStaticAtoms fails when run in dist/bin
|
||||
|
|
Загрузка…
Ссылка в новой задаче