# # # add_dir "tests/i_selector" # # add_file "tests/i_selector/__driver__.lua" # content [14129e3631b885efa53c2b3cd38ea18075c6518e] # # patch "tests/common/selectors.lua" # from [e5d3a4b956aa0678cd726adab3acc8ab6a6be578] # to [8263417cd63dacdc5b5d2c2d29c75f4fbae9b2c2] # ============================================================ --- tests/i_selector/__driver__.lua 14129e3631b885efa53c2b3cd38ea18075c6518e +++ tests/i_selector/__driver__.lua 14129e3631b885efa53c2b3cd38ea18075c6518e @@ -0,0 +1,34 @@ + +include("common/selectors.lua") +mtn_setup() + +addfile("testfile", "blah blah") +commit() +REV1=base_revision() + +writefile("testfile", "stuff stuff") +commit() +REV2=base_revision() + +-- empty id selector +selmap("i:", {REV1, REV2}) +-- standard selection +selmap("i:" .. REV1, {REV1}) +selmap("i:" .. REV2, {REV2}) + + +-- assume the generated revisions id's differ in their first character. +assert(not (string.sub(REV1, 1, 1) == string.sub(REV2, 1, 1))) + +-- expanding from the first four chars +selmap("i:" .. string.sub(REV1, 1, 4), {REV1}) +selmap("i:" .. string.sub(REV2, 1, 4), {REV2}) + +-- expanding from the first two chars +selmap("i:" .. string.sub(REV1, 1, 2), {REV1}) +selmap("i:" .. string.sub(REV2, 1, 2), {REV2}) + +-- expanding from the first char only +selmap_xfail("i:" .. string.sub(REV1, 1, 1), {REV1}) +selmap_xfail("i:" .. string.sub(REV2, 1, 1), {REV2}) + ============================================================ --- tests/common/selectors.lua e5d3a4b956aa0678cd726adab3acc8ab6a6be578 +++ tests/common/selectors.lua 8263417cd63dacdc5b5d2c2d29c75f4fbae9b2c2 @@ -1,5 +1,11 @@ end function selmap(sel, revs, sort) check(raw_mtn("automate", "select", sel), 0, true, false) if sort ~= false then table.sort(revs) end check(samelines("stdout", revs)) end + +function selmap_xfail(sel, revs, sort) + check(raw_mtn("automate", "select", sel), 0, true, false) + if sort ~= false then table.sort(revs) end + xfail(samelines("stdout", revs)) +end