[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix reverting a replacement without properties + regression test

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2004-03-02 23:49:26 CET

Ben Reser <ben@reser.org> writes:

The existing test in revert_tests might not be the best example to
copy, take at look at some of the other tests, merge_tests.py
perhaps.

> +#----------------------------------------------------------------------
> +# Regression test for reverting a replaced file with no properties
> +def revert_replaced_file(sbox):
> + "revert a replaced file"
> +
> + sbox.build()
> + wc_dir = sbox.wc_dir
> +
> + # Create and schedule file1 for addition
> + file1_path = os.path.join(wc_dir, 'file1')
> + svntest.main.file_append(file1_path, "This is the file 'file1'.")
> + svntest.main.run_svn(None, 'add', file1_path)

I'd prefer to see run_and_verify_svn using None and [] for stdout and
stderr, i.e. verify that there is no error output.

> +
> + # check in this as rev1
> + svntest.main.run_svn(None, 'ci', '-m','log message', wc_dir)

I'd prefer to see run_and_verify_commit.

> +
> + # delete file1
> + svntest.main.run_svn(None, 'rm', file1_path)

Again, I'd prefer run_and_verify_svn.

> +
> + # recreate and add the file
> + svntest.main.file_append(file1_path, "This is the file 'file1' version 2.")
> + svntest.main.run_svn(None, 'add', file1_path)

I'd like to see run_and_verify_status to ensure that the file really
is status add.

> +
> + # revert file
> + svntest.actions.run_and_verify_svn(None, ["Reverted '" + file1_path + "'\n"],
> + None, 'revert', file1_path)

I'd like to see run_and_verify_status to ensure that the status add
really did get reverted.

Your current test probably covers the existing error, but it could do
more. Without proper error checking it is easy to end up with a test
that passes even when a bug is present (imagine if a revert bug gets
introduced such that revert has no effect other than to print
"Reverted foo").

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 2 23:48:22 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.