test-reach: test get_merge_bases_many
[gitweb.git] / t / t6600-test-reach.sh
index 966309c6cfb2eca3f5a390f618b29baef5cb8eaa..d43e1a61d55f0ea574f017d276191ce97f0d8b8b 100755 (executable)
@@ -83,4 +83,59 @@ test_expect_success 'ref_newer:hit' '
        test_three_modes ref_newer
 '
 
+test_expect_success 'in_merge_bases:hit' '
+       cat >input <<-\EOF &&
+       A:commit-5-7
+       B:commit-8-8
+       EOF
+       echo "in_merge_bases(A,B):1" >expect &&
+       test_three_modes in_merge_bases
+'
+
+test_expect_success 'in_merge_bases:miss' '
+       cat >input <<-\EOF &&
+       A:commit-6-8
+       B:commit-5-9
+       EOF
+       echo "in_merge_bases(A,B):0" >expect &&
+       test_three_modes in_merge_bases
+'
+
+test_expect_success 'is_descendant_of:hit' '
+       cat >input <<-\EOF &&
+       A:commit-5-7
+       X:commit-4-8
+       X:commit-6-6
+       X:commit-1-1
+       EOF
+       echo "is_descendant_of(A,X):1" >expect &&
+       test_three_modes is_descendant_of
+'
+
+test_expect_success 'is_descendant_of:miss' '
+       cat >input <<-\EOF &&
+       A:commit-6-8
+       X:commit-5-9
+       X:commit-4-10
+       X:commit-7-6
+       EOF
+       echo "is_descendant_of(A,X):0" >expect &&
+       test_three_modes is_descendant_of
+'
+
+test_expect_success 'get_merge_bases_many' '
+       cat >input <<-\EOF &&
+       A:commit-5-7
+       X:commit-4-8
+       X:commit-6-6
+       X:commit-8-3
+       EOF
+       {
+               echo "get_merge_bases_many(A,X):" &&
+               git rev-parse commit-5-6 \
+                             commit-4-7 | sort
+       } >expect &&
+       test_three_modes get_merge_bases_many
+'
+
 test_done