Skip to content

Commit 733ad2e

Browse files
charvi-077gitster
authored andcommitted
t/t3437: remove the dependency of 'expected-message' file from tests
As it is currently implemented, it's too difficult to follow along and remember the value of "expected-message" from test to test. It also makes it difficult to extend tests or add new tests in between existing tests without negatively impacting other tests. Let's set up "expected-message" to the precise content needed by the test, so that both the problems go away and also makes easier to run tests selectively with '--run' or 'GIT_SKIP_TESTS' Mentored-by: Christian Couder <[email protected]> Mentored-by: Phillip Wood <[email protected]> Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Charvi Mendiratta <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1766516 commit 733ad2e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

t/t3437-rebase-fixup-options.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ test_expect_success 'setup' '
4646
body
4747
EOF
4848
49-
sed "1,2d" message >expected-message &&
50-
5149
test_commit A A &&
5250
test_commit B B &&
5351
get_author HEAD >expected-author &&
@@ -134,6 +132,7 @@ test_expect_success 'simple fixup -c works' '
134132
test_expect_success 'fixup -C removes amend! from message' '
135133
test_when_finished "test_might_fail git rebase --abort" &&
136134
git checkout --detach A1 &&
135+
git log -1 --pretty=format:%b >expected-message &&
137136
FAKE_LINES="1 fixup_-C 2" git rebase -i A &&
138137
test_cmp_rev HEAD^ A &&
139138
test_cmp_rev HEAD^{tree} A1^{tree} &&
@@ -145,13 +144,14 @@ test_expect_success 'fixup -C removes amend! from message' '
145144
test_expect_success 'fixup -C with conflicts gives correct message' '
146145
test_when_finished "test_might_fail git rebase --abort" &&
147146
git checkout --detach A1 &&
147+
git log -1 --pretty=format:%b >expected-message &&
148+
test_write_lines "" "edited" >>expected-message &&
148149
test_must_fail env FAKE_LINES="1 fixup_-C 2" git rebase -i conflicts &&
149150
git checkout --theirs -- A &&
150151
git add A &&
151152
FAKE_COMMIT_AMEND=edited git rebase --continue &&
152153
test_cmp_rev HEAD^ conflicts &&
153154
test_cmp_rev HEAD^{tree} A1^{tree} &&
154-
test_write_lines "" edited >>expected-message &&
155155
test_commit_message HEAD expected-message &&
156156
get_author HEAD >actual-author &&
157157
test_cmp expected-author actual-author

0 commit comments

Comments
 (0)