3 # Copyright (c) 2023 Mark Jamsek <mark@jamsek.dev>
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 test_init tree_basic 48 8
23 local head_id=`git_show_head $testroot/repo`
25 cat <<EOF >$TOG_TEST_SCRIPT
29 cat <<EOF >$testroot/view.expected
40 cd $testroot/repo && tog tree
41 cmp -s $testroot/view.expected $testroot/view
43 if [ $ret -ne 0 ]; then
44 diff -u $testroot/view.expected $testroot/view
45 test_done "$testroot" "$ret"
49 test_done "$testroot" "$ret"
52 test_tree_vsplit_blame()
54 test_init tree_vsplit_blame 120 8
56 local head_id=`git_show_head $testroot/repo`
57 local head_id_truncated=`trim_obj_id 8 $head_id`
58 local head_id_short=`trim_obj_id 32 $head_id`
60 cat <<EOF >$TOG_TEST_SCRIPT
62 WAIT_FOR_UI wait for blame to finish
66 cat <<EOF >$testroot/view.expected
67 commit $head_id_truncated|commit $head_id
77 cd $testroot/repo && tog tree
78 cmp -s $testroot/view.expected $testroot/view
80 if [ $ret -ne 0 ]; then
81 diff -u $testroot/view.expected $testroot/view
82 test_done "$testroot" "$ret"
86 test_done "$testroot" "$ret"
89 test_tree_hsplit_blame()
91 test_init tree_hsplit_blame 48 24
93 local head_id=`git_show_head $testroot/repo`
94 local head_id_truncated=`trim_obj_id 8 $head_id`
95 local head_id_short=`trim_obj_id 32 $head_id`
97 cat <<EOF >$TOG_TEST_SCRIPT
100 S toggle horizontal split
101 4- 4x decrease blame split
102 WAIT_FOR_UI wait for blame to finish
106 cat <<EOF >$testroot/view.expected
117 ------------------------------------------------
133 cd $testroot/repo && tog tree
134 cmp -s $testroot/view.expected $testroot/view
136 if [ $ret -ne 0 ]; then
137 diff -u $testroot/view.expected $testroot/view
138 test_done "$testroot" "$ret"
142 test_done "$testroot" "$ret"
147 test_init tree_symlink 48 8
149 (cd $testroot/repo && ln -s alpha symlink)
150 (cd $testroot/repo && git add symlink)
151 git_commit $testroot/repo -m "symlink to alpha"
152 local head_id=`git_show_head $testroot/repo`
154 cat <<EOF >$TOG_TEST_SCRIPT
158 cat <<EOF >$testroot/view.expected
169 cd $testroot/repo && tog tree
170 cmp -s $testroot/view.expected $testroot/view
172 if [ $ret -ne 0 ]; then
173 diff -u $testroot/view.expected $testroot/view
174 test_done "$testroot" "$ret"
178 test_done "$testroot" "$ret"
182 run_test test_tree_basic
183 run_test test_tree_vsplit_blame
184 run_test test_tree_hsplit_blame
185 run_test test_tree_symlink