In test, set up the post-commit hook for more realism (and bugs!).
To make wrappers work in test, set PERL5LIB, and allow the wrappee's
path to be overridden. Meta-test that post-commit is really hooked
up by verifying that content is getting generated in destdir.
About the longstanding bug, which as far as I know was harmless:
CVS can't operate outside a srcdir, so we're always setting $CWD.
"local $CWD" restores the previous value when we go out of scope.
Usually that's correct. But if we're removing the last file from a
directory, the post-commit hook will exec in a working directory
that's about to not exist (CVS will prune it).
The fix: chdir() manually in cvs_runcvs(), so we can selectively
not chdir() back.
If the title of a trail changes, each member of that trail must be
rebuilt, for its prev/up/next box to reflect the new title.
If the title of a member changes, its next and previous items (if any)
must be rebuilt, for their prev/up/next boxes to reflect the new title.
Previously, prune("wiki/srcdir/sandbox/test.mdwn") could delete srcdir
or even wiki, if they happened to be empty. This is rarely what you
want: there's usually some base directory (destdir, srcdir, transientdir
or another subdirectory of wikistatedir) beyond which you do not want to
delete.
This ensures that when we do the second phase of the test (edit some
files and refresh), the changes get a different mtime and are picked up,
even if the entire test happened between two 1-second "clock ticks".
* Test that adding a text file under a name formerly tracked as
binary (and vice versa) gets the right keyword-substitution
behavior.
* Explicitly set -kkv for text files to make the tests pass.
* CVS warns in these cases about "changing keyword expansion mode",
but this is correct behavior, so filter it from stderr. Filter
stdout the same way in case we ever want to keep any of it.
* In rcs_add(), replace comments with obviousness.
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().
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).
* 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.
* 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
* 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.
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.
In the first test, discount returns the html attributes in a different
order, which broke the test. Test only for the important text, not the
exact html output.
In the second test, discount does some encoding of its own of the partially
encoded url, again resulting in different output.