test: add a behavior test for 0-length loop fix

This commit is contained in:
David Rubin 2025-03-24 00:04:07 -07:00 committed by David Rubin
parent ae442e2c29
commit 22013f1b39
No known key found for this signature in database
GPG Key ID: AC75E78E3846781D

View File

@ -535,3 +535,12 @@ test "return from inline for" {
};
try std.testing.expect(!S.do());
}
test "for loop 0 length range" {
const map: []const u8 = &.{};
for (map, 0..map.len) |i, j| {
_ = i;
_ = j;
comptime unreachable;
}
}