Branch: Tag:

2018-04-03

2018-04-03 13:12:12 by Karl Gustav Sterneberg <kg@roxen.com>

Testsuite [WebDAV]: Refactored charset enc./case sensitive put test.

537:    if (apply_string_to_utf8) {    filenames = map(filenames, string_to_utf8);    } +  // NB: We do not want to encode dir in any way. Should be as given.    return map(filenames, lambda(string filename) {    return Stdio.append_path(dir, filename);    });
2104:    foreach (({"NFC", "NFD"}), string unicode_method_put2) {    foreach (({"mc", "lc", "uc"}), string case_put2) {    string filename = sprintf("%0"+w+"d_%s", count++, str); -  string dir1 = make_filenames(this::testcase_dir, filename, +  string dir = make_filenames(this::testcase_dir, filename,    unicode_method_put1, true)[case_put1]; -  string file1 = make_filenames(dir1, filename, +  string file1 = make_filenames(dir, filename,    unicode_method_put1, true)[case_put1]; -  string dir2 = make_filenames(this::testcase_dir, filename, +  string file2 = make_filenames(dir, filename,    unicode_method_put2, true)[case_put2]; -  string file2 = make_filenames(dir2, filename, -  unicode_method_put2, true)[case_put2]; +     string exp_dir = make_filenames(this::testcase_dir, filename,    "NFC", false)[case_put1];    mapping(string:string) exp_file = make_filenames(exp_dir, filename,    "NFC", false); -  webdav_mkcol(dir1, STATUS_CREATED); -  if (!caseSensitive || (case_put1 == case_put2)) { -  webdav_mkcol(dir2, STATUS_METHOD_NOT_ALLOWED); -  } else { -  webdav_mkcol(dir2, STATUS_CREATED); -  } +  webdav_mkcol(dir, STATUS_CREATED);    webdav_put(file1, "FILE " + count, STATUS_CREATED);    // Try to put again, possibly with different encoding and    // possible with different case.
2140:    expected_status_code = STATUS_OK;    }    webdav_put(file2, "FILE 2" + count, expected_status_code); -  if (!caseSensitive) { -  webdav_ls(dir1, +  if (case_put1 == case_put2) { +  webdav_ls(dir,    ({ exp_dir, exp_file[case_put1] }) ); -  webdav_ls(dir2, -  ({ exp_dir, exp_file[case_put1] }) ); +     } else { -  webdav_ls(dir1, -  map(({ dir1, file1 }), utf8_to_string) ); -  webdav_ls(dir2, -  map(({ dir2, file2 }), utf8_to_string) ); +  webdav_ls(dir, +  caseSensitive ? +  ({ exp_dir, +  exp_file[case_put1], +  exp_file[case_put2] }) : +  ({ exp_dir, +  exp_file[case_put2] }) );    }    }    }