# # # rename "tests/automate_get_file" # to "tests/automate_get_file,_automate_get_file_of" # # patch "tests/automate_get_file,_automate_get_file_of/__driver__.lua" # from [f4e10eb071b19187a5b8c1d93aed1a72c6bc8d80] # to [1488e443fdf351aad88fc3c2fbdb93a0c1dd3f3f] # # patch "testsuite.lua" # from [d11d31cc54c5714bd58298f2becc328522afa189] # to [6586c50e0f73ac0e200f0b0bac97f087da9543c1] # ============================================================ --- tests/automate_get_file,_automate_get_file_of/__driver__.lua f4e10eb071b19187a5b8c1d93aed1a72c6bc8d80 +++ tests/automate_get_file,_automate_get_file_of/__driver__.lua 1488e443fdf351aad88fc3c2fbdb93a0c1dd3f3f @@ -1,16 +1,21 @@ mtn_setup() mtn_setup() +fileid = "4cbd040533a2f43fc6691d773d510cda70f4126a" + writefile("expected", "blah\n") +addfile("foo", "blah\n") -addfile("foo", "blah\n") check(mtn("commit", "--date=2005-05-21T12:30:51", "--branch=testbranch", "--message=blah-blah"), 0, false, false) -rev = base_revision() -file = "4cbd040533a2f43fc6691d773d510cda70f4126a" +rev1 = base_revision() +-- +-- get_file tests +-- + -- check that a correct usage produces correctly formatted output -check(mtn("automate", "get_file", file), 0, true, false) +check(mtn("automate", "get_file", fileid), 0, true, false) canonicalize("stdout") check(samefile("expected", "stdout")) @@ -19,5 +24,31 @@ check(fsize("stdout") == 0) check(fsize("stdout") == 0) -- ensure that revisions are not being completed -check(mtn("automate", "get_file", string.sub(file, 1, 30)), 1, true, false) +check(mtn("automate", "get_file", string.sub(fileid, 1, 30)), 1, true, false) check(fsize("stdout") == 0) + +-- +-- get_file_of tests +-- + +-- check if the file is properly outputted +check(mtn("automate", "get_file_of", "foo"), 0, true, false) +canonicalize("stdout") +check(samefile("expected", "stdout")) + +-- ensure that unknown paths fail +check(mtn("automate", "get_file_of", "bar"), 1, true, false) +check(fsize("stdout") == 0) + +-- ensure that unknown revisions fail +check(mtn("automate", "get_file_of", "-r", string.rep("0", 40), filename), 1, true, false) +check(fsize("stdout") == 0) + +-- ensure that a former revision's file contents are readable as well +writefile("foo", "foobar\n"); +commit() +rev2 = base_revision() +check(mtn("automate", "get_file_of", "-r", rev1, "foo"), 0, true, false) +canonicalize("stdout") +check(samefile("expected", "stdout")) + ============================================================ --- testsuite.lua d11d31cc54c5714bd58298f2becc328522afa189 +++ testsuite.lua 6586c50e0f73ac0e200f0b0bac97f087da9543c1 @@ -581,7 +581,7 @@ table.insert(tests, "things_in_.mtn-igno table.insert(tests, "mtn_read_FILE") table.insert(tests, "setup_on_existing_path") table.insert(tests, "things_in_.mtn-ignore_get_ignored") -table.insert(tests, "automate_get_file") +table.insert(tests, "automate_get_file,_automate_get_file_of") table.insert(tests, "automate_get_manifest_of") table.insert(tests, "automate_get_revision") table.insert(tests, "fail_cleanly_on_unreadable_db")