t3404: remove uneeded calls to set_fake_editor
Some tests were calling set_fake_editor to ensure they had a sane no-op editor set. Now that all the editor setting is done in subshells these tests can rely on EDITOR=: and so do not need to call set_fake_editor. Also add a test at the end to detect any future additions messing with the exported value of $EDITOR. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b2dbacbddf
commit
6a619ca03c
@@ -118,3 +118,31 @@ make_empty () {
|
||||
git commit --allow-empty -m "$1" &&
|
||||
git tag "$1"
|
||||
}
|
||||
|
||||
# Call this (inside test_expect_success) at the end of a test file to
|
||||
# check that no tests have changed editor related environment
|
||||
# variables or config settings
|
||||
test_editor_unchanged () {
|
||||
# We're only interested in exported variables hence 'sh -c'
|
||||
sh -c 'cat >actual <<-EOF
|
||||
EDITOR=$EDITOR
|
||||
FAKE_COMMIT_AMEND=$FAKE_COMMIT_AMEND
|
||||
FAKE_COMMIT_MESSAGE=$FAKE_COMMIT_MESSAGE
|
||||
FAKE_LINES=$FAKE_LINES
|
||||
GIT_EDITOR=$GIT_EDITOR
|
||||
GIT_SEQUENCE_EDITOR=$GIT_SEQUENCE_EDITOR
|
||||
core.editor=$(git config core.editor)
|
||||
sequence.editor=$(git config sequence.editor)
|
||||
EOF'
|
||||
cat >expect <<-\EOF
|
||||
EDITOR=:
|
||||
FAKE_COMMIT_AMEND=
|
||||
FAKE_COMMIT_MESSAGE=
|
||||
FAKE_LINES=
|
||||
GIT_EDITOR=
|
||||
GIT_SEQUENCE_EDITOR=
|
||||
core.editor=
|
||||
sequence.editor=
|
||||
EOF
|
||||
test_cmp expect actual
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user