require 'test/unit' class AddTest < Test::Unit::TestCase include MirrorTest def testSimpleAdd root = use_source file1 = File.join(root, "file1") File.open(file1, "w") do |f| f.puts("Some content") end @p4.run_add(file1) mirror_and_compare() root = use_target opened = @p4.run_opened("#{root}/...") assert(opened.length == 1, "Not one file open under target root") end def testBranchAdd root = use_source file1 = File.join(root, "file1") File.open(file1, "w") do |f| f.puts("Some content") end @p4.run_add(file1) @p4.run_submit('-d', "File1 added") file2 = File.join(root, "file2") @p4.run_integrate(file1, file2) @p4.run_add(file2) File.open(file2, "a") do |f| f.puts("More content") end mirror_and_compare() root = use_target opened = @p4.run_opened("#{root}/...") assert(opened.length == 1, "Not one file open under target root") end def testAddWithIntegrate root = use_source file1 = File.join(root, "file1") File.open(file1, "w") do |f| f.puts("Some content") end @p4.run_add('-t', 'text+m', file1) @p4.run_submit('-d', "File1 added") assert( @p4.run_files(file1)[0]['type'] == 'text+m', "Not the correct filetype") file2 = File.join(root, "file2") File.open(file2, "w") do |f| f.puts("More content") end @p4.run_add(file2) assert( @p4.run_opened(file2)[0]['type'] == 'text', "Opened file not the correct type") @p4.run_integrate('-i', file1, file2) mirror_and_compare() root = use_target opened = @p4.run_opened("#{root}/...") assert(opened.length == 1, "Not one file open under target root") end end