Roxen.git / server / etc / test / modules / TEST.pmod / http.pmod / WebDAV.pmod / TestBase.pike

version» Context lines:

Roxen.git/server/etc/test/modules/TEST.pmod/http.pmod/WebDAV.pmod/TestBase.pike:530:    mapping(string:string) filenames =    (["mc" : filename,    "lc" : lower_case(filename),    "uc" : upper_case(filename)]);    if (unicode_method) {    filenames = map(filenames, Unicode.normalize, unicode_method);    }    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);    });   }      protected void verify_lock_token(WebDAVResponse res) {    ASSERT_EQUAL(res->status, STATUS_LOCKED);    // TODO: Parse data and verify response contains the    // 'lock-token-submitted' precondition element and that is looks as expected.    ASSERT_CALL_TRUE(has_value, res->data, "lock-token-submitted");
Roxen.git/server/etc/test/modules/TEST.pmod/http.pmod/WebDAV.pmod/TestBase.pike:2097:    int count = 0;    bool caseSensitive = case_sensitive();    int w = sizeof("" + (sizeof(FILENAMES)*2*3) );    foreach (FILENAMES, string str) {    // TODO: Skip the following 2 loops and just pick an encoding and a case for the src, or?    foreach (({"NFC", "NFD"}), string unicode_method_put1) {    foreach (({"mc", "lc", "uc"}), string case_put1) {    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.    int expected_status_code = STATUS_CREATED;    bool filenames_considered_equal;    if (caseSensitive) {    filenames_considered_equal =    Unicode.normalize(utf8_to_string(file1), "NFC") ==    Unicode.normalize(utf8_to_string(file2), "NFC");    } else {    filenames_considered_equal =    lower_case(Unicode.normalize(utf8_to_string(file1), "NFC")) ==    lower_case(Unicode.normalize(utf8_to_string(file2), "NFC"));    }    if (filenames_considered_equal) {    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] }) );    }    }    }    }    }    }   }      // Test copy where src and target is the same except for case.   public void test_x_copy_file()