Skip to content

Commit

Permalink
decrease false negatives for str overflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
ExpHP committed Apr 30, 2018
1 parent ce66f5d commit 02b3da1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/liballoc/tests/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,9 @@ mod slice_index {
mod rangeinclusive {
let DATA = "hello";

let BAD_INPUT = 1..=usize::max_value();
// note: using 0 specifically ensures that the result of overflowing is 0..0,
// so that `get` doesn't simply return None for the wrong reason.
let BAD_INPUT = 0..=usize::max_value();
const EXPECT_MSG = "maximum usize";

!!generate_tests!!
Expand Down

0 comments on commit 02b3da1

Please sign in to comment.