| 230 | } |
| 231 | |
| 232 | static void testCharsetDetection(String * path) |
| 233 | { |
| 234 | printf("testCharsetDetection\n"); |
| 235 | String * inputPath = path->stringByAppendingPathComponent(MCSTR("input")); |
| 236 | Array * list = pathsInDirectory(inputPath); |
| 237 | int failure = 0; |
| 238 | int success = 0; |
| 239 | mc_foreacharray(String, filename, list) { |
| 240 | Data * data = Data::dataWithContentsOfFile(filename); |
| 241 | String * charset = data->charsetWithFilteredHTML(false); |
| 242 | charset = charset->lowercaseString(); |
| 243 | if (!filename->lastPathComponent()->stringByDeletingPathExtension()->isEqual(charset)) { |
| 244 | failure ++; |
| 245 | fprintf(stderr, "testCharsetDetection: failed for %s\n", MCUTF8(filename)); |
| 246 | fprintf(stderr, "got: %s\n", MCUTF8(charset)); |
| 247 | } |
| 248 | else { |
| 249 | success ++; |
| 250 | } |
| 251 | } |
| 252 | if (failure > 0) { |
| 253 | printf("testCharsetDetection ok: %i succeeded, %i failed\n", success, failure); |
| 254 | global_failure ++; |
| 255 | return; |
| 256 | } |
| 257 | printf("testCharsetDetection ok: %i succeeded\n", success); |
| 258 | global_success ++; |
| 259 | } |
| 260 | |
| 261 | static String * tweakDateFromSummary(String * summary) { |
| 262 | Array * components = summary->componentsSeparatedByString(MCSTR("\n")); |
no test coverage detected