Skip to content

Commit ee21b95

Browse files
committed
fix string map
1 parent 6442c20 commit ee21b95

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

source/mir/string_map.d

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,6 @@ struct StringMap(T, U = uint)
556556
return implementation._values[index];
557557
}
558558
assert (index <= length);
559-
index = index < length ? implementation.indices[index] : length;
560-
assert (index <= length);
561559
}
562560
else
563561
{
@@ -623,8 +621,6 @@ struct StringMap(T, U = uint)
623621
return implementation.values[index];
624622
}
625623
assert (index <= length);
626-
index = index < length ? implementation.indices[index] : length;
627-
assert (index <= length);
628624
}
629625
else
630626
{
@@ -942,3 +938,18 @@ private struct StructImpl(T, U = uint)
942938
return false;
943939
}
944940
}
941+
942+
unittest
943+
{
944+
import mir.algebraic_alias.json: JsonAlgebraic;
945+
import mir.string_map: StringMap;
946+
947+
StringMap!JsonAlgebraic token;
948+
token[`access_token`] = "secret-data";
949+
token[`expires_in`] = 3599;
950+
token[`token_type`] = "Bearer";
951+
952+
assert(token[`access_token`] == "secret-data");
953+
assert(token[`expires_in`] == 3599);
954+
assert(token[`token_type`] == "Bearer"); // mir/string_map.d(511): No member: token_type
955+
}

0 commit comments

Comments
 (0)