# # add_file "tests/t_diff_external.at" # # patch "ChangeLog" # from [a321dd0e463e1c53e4fbe10d2f596c346813c94d] # to [6b49c2cdcfafd535f770953cf14b0369f5f28d0a] # # patch "tests/t_diff_external.at" # from [] # to [5ad9689e0dc5cb71f3cddb1a30c151a89be71d02] # # patch "testsuite.at" # from [4aa4dfcf4f81601bb0894fcdca7a7e76913010b4] # to [0053f6d5ae281707c89693dbf4e0c6b3c4a8b61c] # --- ChangeLog +++ ChangeLog @@ -1,5 +1,10 @@ 2005-07-17 Nathaniel Smith + * tests/t_diff_external.at: New test. + * testsuite.at: Add it. + +2005-07-17 Nathaniel Smith + * monotone.texi (Restrictions): diff -r -r does accept restrictions now. (CVS Phrasebook): Clarify diff section. --- tests/t_diff_external.at +++ tests/t_diff_external.at @@ -0,0 +1,56 @@ +AT_SETUP([diff --external]) +MONOTONE_SETUP + +ADD_FILE(testfile, [foo bar +]) +COMMIT(testbranch) +OLD_SHA=`SHA1(testfile)` +AT_CHECK(cp testfile old_testfile) + +SET_FILE(testfile, [stuff stuff +]) +NEW_SHA=`SHA1(testfile)` + +AT_DATA(testhook.lua, [function external_diff(file_path, data_old, data_new, is_binary, diff_args, rev_old, rev_new) + io.write("file_path: " .. file_path .. "\n") + f = io.open("old_version", "w") + f:write(data_old) + io.close(f) + f = io.open("new_version", "w") + f:write(data_new) + io.close(f) + if diff_args == nil then + io.write("diff_args is NIL\n") + else + io.write("diff_args: " .. diff_args .. "\n") + end + io.write("rev_old: " .. rev_old .. "\n") + io.write("rev_new: " .. rev_new .. "\n") +end +]) + +AT_CHECK(MONOTONE --rcfile=testhook.lua diff --external, [], [stdout], [ignore]) +AT_CHECK(grep -q 'file_path: testfile' stdout) +AT_CHECK(cmp old_version old_testfile) +AT_CHECK(cmp new_version testfile) +AT_CHECK(grep -q 'diff_args is NIL' stdout) +AT_CHECK(grep -q "rev_old: $OLD_SHA" stdout) +AT_CHECK(grep -q "rev_new: $NEW_SHA" stdout) + +AT_CHECK(MONOTONE --rcfile=testhook.lua diff --external --diff-args="-foobar", [], [stdout], [ignore]) +AT_CHECK(grep -q 'file_path: testfile' stdout) +AT_CHECK(cmp old_version old_testfile) +AT_CHECK(cmp new_version testfile) +AT_CHECK(grep -q 'diff_args: -foobar' stdout) +AT_CHECK(grep -q "rev_old: $OLD_SHA" stdout) +AT_CHECK(grep -q "rev_new: $NEW_SHA" stdout) + +AT_CHECK(MONOTONE --rcfile=testhook.lua diff --external --diff-args="", [], [stdout], [ignore]) +AT_CHECK(grep -q 'file_path: testfile' stdout) +AT_CHECK(cmp old_version old_testfile) +AT_CHECK(cmp new_version testfile) +AT_CHECK(egrep -q '^diff_args: $' stdout) +AT_CHECK(grep -q "rev_old: $OLD_SHA" stdout) +AT_CHECK(grep -q "rev_new: $NEW_SHA" stdout) + +AT_CLEANUP --- testsuite.at +++ testsuite.at @@ -673,3 +673,4 @@ m4_include(tests/t_kill_tag_locally.at) m4_include(tests/t_restricted_diff_unchanged.at) m4_include(tests/t_selector_globbing.at) +m4_include(tests/t_diff_external.at)