Commit Graph

23 Commits (d23ecdea299ddfc5ff12c76dc619bb2b1557d16b)

Author SHA1 Message Date
Amitai Schlair a65512ad18 Update test plan, missed in previous. 2012-02-01 22:08:21 -05:00
Amitai Schlair fc316b9da1 Express rcs_recentchanges() tests via utility functions, in preparation
for writing more thorough tests, in order to safely extract the
cvsps output-parsing routine for reuse by an upcoming rcs_revert().
2012-02-01 15:17:57 -05:00
Amitai Schlair b0d97cd20e Fail a test if an rcs_receive() hook is ever defined for CVS. 2012-02-01 11:04:37 -05:00
Amitai Schlair 1d176f23d2 Extract add_and_commit(), a common test action. 2012-02-01 11:04:15 -05:00
Amitai Schlair ac8eab29e8 Uncomment the CVS keyword substitution mode tests, and make them pass:
Extract cvs_keyword_subst_args() and ensure it runs in $config{srcdir}.
Using Perl's -T operator appears to work equally well, perhaps switch?
2012-01-26 16:57:00 -05:00
Amitai Schlair 1b73015251 Move tests that simulate web commits into test_rcs_add(), then add
a bunch more tests (that wind up exercising rcs_commit(),
rcs_commit_staged(), and rcs_recentchanges()). Extract some support
routines for brevity. Most is_in_keyword_substitution_mode() tests
are commented out because there's a bug -- non-binary files are
being added with "cvs add -kb".

Move tests that inspect recentchanges after direct CVS operations
into test_rcs_recentchanges().
2012-01-24 05:58:41 -05:00
Amitai Schlair ad0e56cdca Define required programs and modules at top for easy spotting. 2012-01-22 11:07:58 -05:00
Amitai Schlair 8e99750545 No functional change: sort sub definitions.
In the code:
* general plugin API calls (in plugins/write order),
* VCS plugin API calls (in plugins/write order), then
* internal support routines (in alphabetical order).

In the tests:
* general meta-behavior (in no particular order, yet),
* general plugin API calls (in plugins/write order),
* VCS plugin API calls (in plugins/write order), then
* internal support routines (in semi-logical order).
2012-01-22 10:44:50 -05:00
Amitai Schlair ea04eb4102 Test::Class runs test subs in alphabetical order, so we do too. 2012-01-22 10:44:50 -05:00
Amitai Schlair 88b08b5835 Ape xUnit more closely to remove ordering constraints on test subs:
* Add setup and teardown methods, called before and after every test sub.
* In setup, make a fresh repo; in teardown, throw it out.
* Extract runtests method and define default test methods at top.
* Move reflection routines near the xUnit-style subs they support.

Adapt existing test subs to run independently:
* In test_manual_add_and_commit(), assume a fresh repo.

While here, plan a bit better:
* Check for all modules used by cvs.pm.
* Check for program existence more generally.
* Check that we can rmdir after mkdir.
2012-01-22 10:44:50 -05:00
Amitai Schlair 1ea4949257 Describe the needed test cases, and implement a couple Test::Class features.
* Run all subs matching /^test_*/ (for which we can plan)...
* Unless TEST_METHOD is set, in which case run matching subs (sans plan).
* Define total number of tests very near 'use Test::More', where expected.
* Define test tempdir where it's declared, no longer any reason why not.
* Move most comments from TODO.cvs into t/cvs.t.
* Add a whole bunch more comments describing the needed test cases.

XXX existing tests are order-dependent, but currently happen to pass
2012-01-22 10:44:49 -05:00
Amitai Schlair 3497f49f35 Fix regression: failing to make the temp dir should nix the test plan.
While here, nitpick style and wrap long lines.
2012-01-22 10:44:49 -05:00
Amitai Schlair 0b7d5aeeb6 Use config parameters directly and shorten long lines. 2012-01-22 10:44:49 -05:00
Amitai Schlair d760df3821 * Define expected number of tests near the top.
* Call readfile() directly from writefile().
* Parameterize commit message for the web-commit case.
* Describe intent of test cases.
* Rename test subs to match what they actually do.
* To prove extra path slashes don't cause trouble, instead of running
  the same tests a second time, just assert that checkconfig()
  strips the slashes.
2012-01-22 10:44:49 -05:00
Amitai Schlair b77da0bb3b Fix a typo in the web commit test. 2012-01-22 10:44:49 -05:00
Amitai Schlair f18160b95d Simplify startup: use Test::More unconditionally, then determine
the test plan at runtime. Use IkiWiki unconditionally too (as that's
not what I'm testing here) to avoid the TAP error of printing a
test result before having printed the plan.
2012-01-22 10:44:49 -05:00
Amitai Schlair f98c4c5b72 Extract subs: startup/shutdown, and tests for web and manual commits.
No functional change intended.
2012-01-22 10:44:49 -05:00
Joey Hess 1f6ea9a626 clean up messages about unavailable vcs programs 2010-06-25 00:30:12 -04:00
Joey Hess ecdfd1b864 rcs_commit and rcs_commit_staged api changes
Using named parameters for these is overdue. Passing the session in a
parameter instead of passing username and IP separately will later allow
storing other session info, like username or part of the email.

Note that these functions are not part of the exported API,
and the prototype change will catch (most) skew, so I am not changing
API versions. Any third-party plugins that call them will need updated
though.
2010-06-23 19:04:36 -04:00
Joey Hess 57a135c92a abort test if cvs prereq perl modules are not available 2009-10-14 13:15:12 -04:00
Joey Hess e22af796e5 skip if cvsps is not available 2009-09-10 16:49:54 -04:00
Amitai Schlair 98553d1537 CVS operations generally need to be within CVS checkouts, so these chdir()
calls are warranted. They shouldn't modify the caller's working directory,
though. Use File::chdir to keep the scope of the changes subroutine-local.
The tests now pass without resetting the working directory.
2009-09-10 00:51:34 -04:00
Amitai Schlair 12bbc6c919 Add automated tests, modeled after svn's. Note the chdir() calls;
perhaps cvs.pm should be doing pushd/popd in case the caller expects
its working directory to be left alone.
2009-09-09 23:09:26 -04:00