Fix the help tests
[tig.git] / test / status / on-branch-test
blobdb2e69cb2d61fcd31a7ef0a6fc5750a7d201f644
1 #!/bin/sh
3 . libtest.sh
4 . libgit.sh
6 export LINES=10
8 test_setup_work_dir()
10 create_repo_from_tgz "$base_dir/files/scala-js-benchmarks.tgz"
11 git checkout -b topic-branch HEAD~4
12 echo "Topic branch" >> README.md
13 git add README.md
14 git_commit -m "Topic branch"
15 git checkout master
17 git checkout -b conflict-branch HEAD~4
18 git rm -f run.sh
19 git_commit -m "Conflict branch"
20 git checkout master
22 git tag v0.2 HEAD~20
23 git branch v0.2-branch v0.2
25 git format-patch -1 conflict-branch --stdout > "$HOME/mailbox"
28 test_case on-branch-master \
29 --args='status' \
30 --before='git checkout master' <<EOF
31 On branch master
32 Changes to be committed:
33 (no files)
34 Changes not staged for commit:
35 (no files)
36 Untracked files:
37 (no files)
39 [status] Nothing to update 100%
40 EOF
42 test_case bisecting-master \
43 --args='status' \
44 --before="git bisect start master" \
45 --after="git bisect reset" <<EOF
46 Bisecting master
47 Changes to be committed:
48 (no files)
49 Changes not staged for commit:
50 (no files)
51 Untracked files:
52 (no files)
54 [status] Nothing to update 100%
55 EOF
57 test_case on-detached-head \
58 --args='status' \
59 --before="git checkout HEAD~10" \
60 --after="git checkout master" \
61 <<EOF
62 HEAD detached at 988c77aad5798f1e087e5d7efe3b3319ee6de744
63 Changes to be committed:
64 (no files)
65 Changes not staged for commit:
66 (no files)
67 Untracked files:
68 (no files)
70 [status] Nothing to update 100%
71 EOF
73 test_case on-detached-tag \
74 --args='status' \
75 --before="git checkout v0.2" \
76 --after="git checkout master" \
77 <<EOF
78 HEAD detached at v0.2
79 Changes to be committed:
80 (no files)
81 Changes not staged for commit:
82 (no files)
83 Untracked files:
84 (no files)
86 [status] Nothing to update 100%
87 EOF
89 test_case merging-master \
90 --args='status' \
91 --before="git merge conflict-branch
92 true" \
93 --after="git reset --hard" \
94 <<EOF
95 Merging master
96 Changes to be committed:
97 (no files)
98 Changes not staged for commit:
99 U run.sh
100 Untracked files:
101 (no files)
103 [status] Nothing to update 100%
106 test_case rebasing-master \
107 --args='status' \
108 --before="git checkout conflict-branch
109 git rebase master
110 true" \
111 --after=" git rebase --abort
112 git checkout master" \
113 <<EOF
114 Rebasing conflict-branch
115 Changes to be committed:
116 (no files)
117 Changes not staged for commit:
118 U run.sh
119 Untracked files:
120 (no files)
122 [status] Nothing to update 100%
125 test_case applying-mailbox-to-master \
126 --args='status' \
127 --before="git am $HOME/mailbox
128 true" \
129 --after="git am --abort" \
130 <<EOF
131 Applying mailbox to master
132 Changes to be committed:
133 (no files)
134 Changes not staged for commit:
135 (no files)
136 Untracked files:
137 (no files)
139 [status] Nothing to update 100%
142 test_case interactive-rebase-of-branch \
143 --args='status' \
144 --before="git checkout conflict-branch
145 git rebase -i master
146 true" \
147 --after=" git rebase --abort
148 git checkout master" \
149 <<EOF
150 Interactive rebase conflict-branch
151 Changes to be committed:
152 (no files)
153 Changes not staged for commit:
154 U run.sh
155 Untracked files:
156 (no files)
158 [status] Nothing to update 100%
161 run_test_cases
163 add_exec_prefix()
165 code="$(cat "$1")"
166 if [ -n "$code" ]; then
167 echo "$code" | sed -e 's/^[ ]*//' -e '/^$/d' -e 's/^/:exec @/'
171 tig_script "all" "
172 $(for name in $(cat test-cases); do
173 add_exec_prefix "$name-before"
174 echo :save-display all-$name.screen
175 add_exec_prefix "$name-after"
176 done)
179 test_tig status
181 for name in $(cat test-cases); do
182 assert_equals "all-$name.screen" < "$name.expected"
183 done