t: sort output of hashmap iteration
[gitweb.git] / t / t0016-oidmap.sh
index af17264ce334cb98f0276af4184f409e0850d22d..31f8276ba82bad3129c4a3cfa92f2d0ba798073c 100755 (executable)
@@ -67,18 +67,44 @@ Unknown oid: invalidOid
 
 '
 
-test_expect_success 'iterate' '
+test_expect_success 'remove' '
 
 test_oidmap "put one 1
 put two 2
 put three 3
-iterate" "NULL
+remove one
+remove two
+remove invalidOid
+remove four" "NULL
 NULL
 NULL
-$(git rev-parse two) 2
-$(git rev-parse one) 1
-$(git rev-parse three) 3"
+1
+2
+Unknown oid: invalidOid
+NULL"
 
 '
 
+test_expect_success 'iterate' '
+       test-tool oidmap >actual.raw <<-\EOF &&
+       put one 1
+       put two 2
+       put three 3
+       iterate
+       EOF
+
+       # sort "expect" too so we do not rely on the order of particular oids
+       sort >expect <<-EOF &&
+       NULL
+       NULL
+       NULL
+       $(git rev-parse one) 1
+       $(git rev-parse two) 2
+       $(git rev-parse three) 3
+       EOF
+
+       sort <actual.raw >actual &&
+       test_cmp expect actual
+'
+
 test_done