[darcs-devel] Help needed with the test harness

Benjamin Franksen ben.franksen at online.de
Thu Aug 10 13:24:35 UTC 2017


On 10.08.2017 03:29, Guillaume Hoffmann wrote:
> I have a two questions to begin with:
> 
> * about "added a test for switching between encodings".Could you add
> more comments in this test script? We already have send-encoding.sh
> and switch-encoding.sh , what does your script test that these others
> do not?

First, switch-encoding.sh is the test that is added by the patch you
refer to. I agree that it needs more comments. It should also be
refactored, it is highly repetitive. Will try to do both.

The send-encoding.sh test is indeed related, however IIUC it does not
test that changes made in a repo with one encoding can be applied to
another (or the same) repo with a different encoding in effect,
resulting in an identical tree.

This is what is now tested. In particular, I am creating a patch with

 * non-ASCII file content
 * non-ASCII file names
 * non-ASCII meta-data (patch name)

The patch is created with a UTF8 locale in effect, then turned into a
bundle. Then I switch to C locale, clone the repo and test that the
working trees are identical. Then I test that the original (UTF8) bundle
can still be applied and resuilts in the same tree. I also test that
darcs properly recognizes already applied bundles and that send -o and
obliterate -o both work, and that the resulting patches can be
obliterated as well as unrecorded and reverted. These tests have been
added because during my development some of these commands had issues
when I manually tested them. Finally we swap the roles of C and UTF8,
i.e. try to apply a bundle created under C encoding when UTF8 is in effect.

> * is there a way to test the changes of "in Darcs.UI.Commands import
> setEnv from System.Environment" and "removed redundant class
> constraint for Darcs.UI.Commands.setEnvDarcsFiles" ?

I saw these changes as mere simplifications, not requiring tests: the
Patchy constraint really is redundant, it is not needed; and using
setEnv from base enables the feature for Windows, too, and allows to
remove #ifdefs. (If it turns out this doesn't actually work on Windows,
we're no worse off than before.)

Tests for DARCS_PATCHES do exist
(tests/issue2312_posthooks_for_record_and_amend-record_should_receive_DARCS_PATCHES.sh,
tests/posthook.sh) but not for DARCS_FILES. However, I am not sure we
have a specification for how non-ASCII things (e.g. file names) are to
be encoded in these environment variables? (For DARCS_PATCHES_XML this
would be UTF8 I guess.)

BTW, I just saw that there is an issue (Issue1813) about
DARCS_PATCHES_XML not working on Windows. This should be closed when we
verify that it does indeed work on Windows now.

Cheers
Ben



More information about the darcs-devel mailing list