Bug 551153 - ###!!! ASSERTION: Not a UTF-8 string when running TestUTF and TestAtoms; (Bv1) Make it fully explicit that Malformed8Strings[] is not to be used in debug builds.

r=jonas.
This commit is contained in:
Serge Gautherie 2010-03-10 21:03:23 +01:00
parent 8168d78122
commit f54b79a4a5
3 changed files with 11 additions and 5 deletions

View File

@ -147,10 +147,10 @@ test_invalid()
return PR_FALSE;
}
// Don't run this test in debug builds as that intentionally asserts.
#ifndef DEBUG
nsCOMPtr<nsIAtom> emptyAtom = do_GetAtom("");
#ifndef DEBUG
// Don't run these tests in debug builds as that intentionally asserts
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(Malformed8Strings); ++i) {
nsrefcnt count = NS_GetNumberOfAtoms();

View File

@ -122,6 +122,8 @@ test_invalid8()
PRBool
test_malformed8()
{
// Don't run this test in debug builds as that intentionally asserts.
#ifndef DEBUG
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(Malformed8Strings); ++i) {
nsDependentCString str8(Malformed8Strings[i]);
@ -136,6 +138,7 @@ test_malformed8()
if (CompareUTF8toUTF16(str8, EmptyString()) == 0)
return PR_FALSE;
}
#endif
return PR_TRUE;
}
@ -161,6 +164,8 @@ test_hashas16()
return PR_FALSE;
}
// Don't run this test in debug builds as that intentionally asserts.
#ifndef DEBUG
for (unsigned int i = 0; i < NS_ARRAY_LENGTH(Malformed8Strings); ++i) {
nsDependentCString str8(Malformed8Strings[i]);
PRBool err;
@ -168,6 +173,7 @@ test_hashas16()
!err)
return PR_FALSE;
}
#endif
return PR_TRUE;
}
@ -184,10 +190,7 @@ tests[] =
{ "test_valid", test_valid },
{ "test_invalid16", test_invalid16 },
{ "test_invalid8", test_invalid8 },
#ifndef DEBUG
// Don't run this test in debug builds as that intentionally asserts
{ "test_malformed8", test_malformed8 },
#endif
{ "test_hashas16", test_hashas16 },
{ nsnull, nsnull }
};

View File

@ -113,6 +113,8 @@ static const UTFStringsStringPair Invalid8Strings[] =
{ 0xFC, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFD, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF } },
};
// Don't use this array in debug builds as that intentionally asserts.
#ifndef DEBUG
static const char Malformed8Strings[][16] =
{
{ 0x80 },
@ -135,5 +137,6 @@ static const char Malformed8Strings[][16] =
{ 'a', 0xFD, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 },
{ 'a', 0xFC, 0x80, 0x80, 0x40, 0x80, 0x80, 'c' },
};
#endif
#endif