class TC_Add < Test::Unit::TestCase include P4RubyTest def name "Test adding files" end def test_add_files assert( p4.connect, "Failed to connect to Perforce server" ) assert( p4.run_opened.length == 0, "Shouldn't have any open files" ) Dir.mkdir( "test_add_files" ) %w{ foo bar baz }.each do |fn| fn = "test_add_files/#{fn}.txt" File.open( fn, "w" ) do |f| f.puts( "This is a test file" ) end p4.run_add( fn ) end assert( p4.run_opened.length == 3, "Unexpected number of open files" ) change = p4.fetch_change assert( change.kind_of?( P4::Spec ), "Change form is not a spec" ) change._description = "Add some test files\n" assert( change._description == "Add some test files\n", "Change description not set properly" ) assert( p4.run_submit( change ), "Failed to add files" ) # Ensure no files are open assert( p4.run_opened.length == 0, "Files remain open after submit" ) end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 14516 | tony |
Change P4Ruby's tests so that there's no longer a specific test for submit, but rather a whole suite of tests for file operations, culminating in a test for 'p4 filelog', which is always interesting... |
||
#1 | 14499 | tony |
Shuffle up the tests to make some room for one that tests setting and getting of client environment vars. Also give nice names to the tests while we're there. |
||
//guest/perforce_software/p4ruby/main/test/03_add_files.rb | |||||
#1 | 14491 | tony |
Add first draft of automated test suite for P4Ruby. Run it using 'ruby test.rb' |