def test_diff(self): """ Test diff """ tpbtools.writefile('mrpm1', ['this is a test file\n']) tpbtools.writefile('mrpm2', ['this is another test file\n']) tpbtools.writefile('mrpm1.2009-10-01', ['copy of test file\n']) tpbtools.writefile('old/mrpm2.2009-08-31', ['copy of another test file\n']) expected = ['diff ./mrpm1.2009-10-01 mrpm1\n', '1c1\n', '< copy of test file\n', '---\n', '> this is a test file\n'] f = os.popen('../fl diff mrpm1') got = f.readlines() f.close() testhelp.expectVSgot(expected, got) expected = ['diff ./old/mrpm2.2009-08-31 mrpm2\n', '1c1\n', '< copy of another test file\n', '---\n', '> this is another test file\n'] f = os.popen('../fl diff mrpm2') got = f.readlines() f.close() testhelp.expectVSgot(expected, got)
def test_most_recent_prefix_match(self): """ Test the routine most_recent_prefix_match() """ tpbtools.writefile('mrpm1', ['this is a test file']) tpbtools.writefile('mrpm2', ['this is another test file']) os.system('cp mrpm1 mrpm1.2009-10-01') os.system('cp mrpm2 old/mrpm2.2009-08-31') a = most_recent_prefix_match('.', 'mrpm1') testhelp.expectVSgot('./mrpm1.2009-10-01', a) a = most_recent_prefix_match('.', 'mrpm2') testhelp.expectVSgot('./old/mrpm2.2009-08-31', a)
def test_revert(self): """ Test revert """ tpbtools.writefile('mrpm1', ['this is a test file\n']) tpbtools.writefile('mrpm2', ['this is another test file\n']) tpbtools.writefile('mrpm1.2009-10-01', ['reverted\n']) tpbtools.writefile('old/mrpm2.2009-08-31', ['REVERTED\n']) os.system('../fl revert mrpm1') assert(os.path.exists('mrpm1.new')) assert(os.path.exists('mrpm1')) assert(not os.path.exists('mrpm1.2009-10-01')) assert(tpbtools.contents('mrpm1') == ['reverted\n']) os.system('../fl revert mrpm2') assert(os.path.exists('mrpm2.new')) assert(os.path.exists('mrpm2')) assert(not os.path.exists('old/mrpm2.2009-08-31')) assert(tpbtools.contents('mrpm2') == ['REVERTED\n'])