Thread (17 messages) flat view 17 messages, 4 authors, 2016-06-15

Re: [PATCH v5 3/4] commit test: test_set_editor in each test

From: Jeff King <hidden>
Date: 2016-06-15 23:01:36

On Thu, Jun 12, 2014 at 02:39:01PM -0500, Caleb Thompson wrote:
t/t7507-commit-verbose.sh was using a global test_set_editor call to
build its environment.

Improve robustness against global state changes by having only tests
which intend to use the $EDITOR to check for presence of a diff in the
editor set up the test-editor to use check-for-diff rather than relying
upon the editor set once at script start.
This implies to me that EDITOR is unset after leaving these tests. I
don't think that is how it works, though.  The tests themselves run in
the main environment of the test script. A call to test_set_editor from
one of them will still affect the other tests[1].

I think it works anyway because every subsequent test that cares
actually sets the editor itself.

Or did you just mean that the new rule is "every test sets the editor as
they need", which means that we do not have to worry anymore about
polluting the environment for other tests?

-Peff

[1] It might make sense for test_set_editor, when run from within a
    test, to behave more like test_config, and do:

      test_when_finished '
        sane_unset FAKE_EDITOR &&
        sane_unset EDITOR
      '

    I don't know if there would be fallouts with other test scripts,
    though.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help