On Tue, Jul 30, 2019 at 09:23:36PM -0400, Jeff King wrote:

>  test_expect_success 'iterate (case insensitive)' '
> -
> -test_hashmap "put key1 value1
> -put key2 value2
> -put fooBarFrotz value3
> -iterate" "NULL
> -NULL
> -NULL
> -fooBarFrotz value3
> -key2 value2
> -key1 value1" ignorecase

By the way, I found it curious that this test is repeated both with and
without ignorecase, but in the case-insensitive we never have any
case-equivalent names!

I guess it is testing that we preserved the name of fooBarFrotz, but I
would think that this:

diff --git a/t/t0011-hashmap.sh b/t/t0011-hashmap.sh
index 5343ffd3f9..2807dff644 100755
--- a/t/t0011-hashmap.sh
+++ b/t/t0011-hashmap.sh
@@ -195,14 +195,15 @@ test_expect_success 'iterate (case insensitive)' '
        put key1 value1
        put key2 value2
        put fooBarFrotz value3
+       put foobarfrotz value4
        iterate
        EOF
 
        cat >expect <<-\EOF &&
        NULL
        NULL
        NULL
-       fooBarFrotz value3
+       fooBarFrotz value4
        key1 value1
        key2 value2
        EOF

on top of my other patch would be a good addition. However, it yields
this result:

--- expect      2019-07-31 01:26:07.284231899 +0000
+++ actual      2019-07-31 01:26:07.284231899 +0000
@@ -1,6 +1,7 @@
 NULL
 NULL
 NULL
-fooBarFrotz value4
+foobarfrotz value4
 key1 value1
 key2 value2
+value3

The first line is a matter of taste I think (whether to keep the
original case or replace it with the new key). But the empty-keyed
retention of value3 seems wrong. I'm not sure if this is a bug in the
actual hashmap code, or just a weirdness with the way test-tool prints
it.

I'm going offline for a bit, so if anybody feels like following up on
the mystery, be my guest. Otherwise I may take a look later tonight.

-Peff

Reply via email to