-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.error messageThis issue points out an error message that is unhelpful and should be improved.This issue points out an error message that is unhelpful and should be improved.
Milestone
Description
Zig Version
0.10.0-dev.1120+0ea51f7f4
Steps to Reproduce
- Paste this code:
const std = @import("std");
test "oob!" {
var foo: [123]u8 = undefined;
foo[std.rand.DefaultPrng.init(100).random().uintAtMost(usize, 99999) + 123] = 123;
}zig test file.zig
Expected Behavior
Something more like this:
test "oob!" failed
oob.zig:4:5
2 | test "oob!" {
3 | var foo: [123]u8 = undefined;
4 | foo[std.rand.DefaultPrng.init(100).random().uintAtMost(usize, 99999) + 123] = 123;
^
panic: index out of bounds
> index: 1209348
> bounds: 122
Stack trace:
test "oob!" | oob.zig:4:5
1 test failure
0 tests passed (0 expectations)
1ms elapsedActual Behavior
❯ zig test /Users/jarred/Desktop/oob.zig
Test [1/1] test "ooob"... thread 5048573 panic: index out of bounds
error: the following test command crashed:
/Users/jarred/Desktop/zig-cache/o/c5163ac39be41b38c5688f3aeff793b0/test /Users/jarred/Build/zig/zigInKryption, svercl, SpexGuy, dantecatalfamo, leighmcculloch and 9 more
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.error messageThis issue points out an error message that is unhelpful and should be improved.This issue points out an error message that is unhelpful and should be improved.