t7800: improve test descriptions with empty arguments
[alt-git.git] / t / t0069-oidtree.sh
blob889db508183f7c858c438aa5144629279660e864
1 #!/bin/sh
3 test_description='basic tests for the oidtree implementation'
4 TEST_PASSES_SANITIZE_LEAK=true
5 . ./test-lib.sh
7 maxhexsz=$(test_oid hexsz)
8 echoid () {
9 prefix="${1:+$1 }"
10 shift
11 while test $# -gt 0
13 shortoid="$1"
14 shift
15 difference=$(($maxhexsz - ${#shortoid}))
16 printf "%s%s%0${difference}d\\n" "$prefix" "$shortoid" "0"
17 done
20 test_expect_success 'oidtree insert and contains' '
21 cat >expect <<-\EOF &&
28 EOF
30 echoid insert 444 1 2 3 4 5 a b c d e &&
31 echoid contains 44 441 440 444 4440 4444 &&
32 echo clear
33 } | test-tool oidtree >actual &&
34 test_cmp expect actual
37 test_expect_success 'oidtree each' '
38 echoid "" 123 321 321 >expect &&
40 echoid insert f 9 8 123 321 a b c d e &&
41 echo each 12300 &&
42 echo each 3211 &&
43 echo each 3210 &&
44 echo each 32100 &&
45 echo clear
46 } | test-tool oidtree >actual &&
47 test_cmp expect actual
50 test_done