Extend automated string tests to cover the formerly-crashing "[]" substitution case (EXT-1282, DEV-41081)

Also 'fix' string tests to match the new expected behaviour of LLStringUtil::format().  They must have been failing dreadfully before, but the legacy tut tests aren't run in a viewer-only build, so...
master
Adam Moss 2009-10-08 12:00:24 +00:00
parent 7db4992f34
commit 2bfe1fc2bc
1 changed files with 3 additions and 2 deletions

View File

@ -554,6 +554,7 @@ namespace tut
fmt_map["[KEYSHORTER]"] = "Am I not a long string?";
fmt_map["?"] = "?";
fmt_map["[DELETE]"] = "";
fmt_map["[]"] = "[]"; // doesn't do a substitution, but shouldn't crash either
for (LLStringUtil::format_map_t::const_iterator iter = fmt_map.begin(); iter != fmt_map.end(); ++iter)
{
@ -562,7 +563,7 @@ namespace tut
std::string s2 = (std::string)iter->second;
subcount = LLStringUtil::format(s1, fmt_map);
ensure_equals("LLStringUtil::format: Raw interpolation result", s1, s2);
if (s1 == "?")
if (s1 == "?" || s1 == "[]") // no interp expected
{
ensure_equals("LLStringUtil::format: Raw interpolation result count", 0, subcount);
}
@ -580,7 +581,7 @@ namespace tut
s = s1 + s1 + s1 + s1;
subcount = LLStringUtil::format(s, fmt_map);
ensure_equals("LLStringUtil::format: Rawx4 interpolation result", s, s2 + s2 + s2 + s2);
if (s1 == "?")
if (s1 == "?" || s1 == "[]") // no interp expected
{
ensure_equals("LLStringUtil::format: Rawx4 interpolation result count", 0, subcount);
}