diff options
author | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-11-25 20:43:11 -0800 |
---|---|---|
committer | Hoa V. DINH <dinh.viet.hoa@gmail.com> | 2014-11-25 20:43:11 -0800 |
commit | 6d8dfe737e5b6fc9a502868705d8553386d314fc (patch) | |
tree | 52465c83d0eaa0bba33f46062b485f7dd2ad84ea | |
parent | d67bf2283cf57ce3414fcf3bd775e53b32c79208 (diff) |
Fixed unit tests result on Linux
-rw-r--r-- | unittest/unittest.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/unittest/unittest.cpp b/unittest/unittest.cpp index 8783e522..c74e2818 100644 --- a/unittest/unittest.cpp +++ b/unittest/unittest.cpp @@ -258,6 +258,17 @@ static void testCharsetDetection(String * path) global_success ++; } +static String * tweakDateFromSummary(String * summary) { + Array * components = summary->componentsSeparatedByString(MCSTR("\n")); + if (components->count() >= 4) { + String * line = (String *) components->objectAtIndex(3); + if (line->hasPrefix(MCSTR("Date:"))) { + line->replaceOccurrencesOfString(MCSTR(" at "), MCSTR(" ")); + } + } + return components->componentsJoinedByString(MCSTR("\n")); +} + static void testSummary(String * path) { printf("testSummary\n"); @@ -278,8 +289,11 @@ static void testSummary(String * path) fprintf(stderr, "test %s is a well-known failing test", MCUTF8(filename)); continue; } + String * resultString = resultData->stringWithCharset("utf-8"); + str = tweakDateFromSummary(str); + resultString = tweakDateFromSummary(resultString); - if (!resultData->stringWithCharset("utf-8")->isEqual(str)) { + if (!resultString->isEqual(str)) { failure ++; fprintf(stderr, "testSummary: failed for %s\n", MCUTF8(filename)); fprintf(stderr, "got: %s\n", MCUTF8(str)); |