rust/src/libcore/tests
Alex Crichton cff1a263c9
Rollup merge of #50010 - ExpHP:slice-bounds, r=alexcrichton
Give SliceIndex impls a test suite of girth befitting the implementation (and fix a UTF8 boundary check)

So one day I was writing something in my codebase that basically amounted to `impl SliceIndex for (Bound<usize>, Bound<usize>)`, and I said to myself:

*Boy, gee, golly!  I never realized bounds checking was so tricky!*

At some point when I had around 60 lines of tests for it, I decided to go see how the standard library does it to see if I missed any edge cases. ...That's when I discovered that libcore only had about 40 lines of tests for slicing altogether, and none of them even used `..=`.

---

This PR includes:

* **Literally the first appearance of the word `get_unchecked_mut` in any directory named `test` or `tests`.**
* Likewise the first appearance of `get_mut` used with _any type of range argument_ in these directories.
* Tests for the panics on overflow with `..=`.
    * I wanted to test on `[(); usize::MAX]` as well but that takes linear time in debug mode </3
* A horrible and ugly test-generating macro for the `should_panic` tests that increases the DRYness by a single order of magnitude (which IMO wasn't enough, but I didn't want to go any further and risk making the tests inaccessible to next guy).
* Same stuff for str!
    * Actually, the existing `str` tests were pretty good. I just helped filled in the holes.
* [A fix for the bug it caught](https://github.com/rust-lang/rust/issues/50002).  (only one ~~sadly~~)
2018-05-10 11:35:17 -05:00
..
fmt Add hexadecimal formatting of integers with fmt::Debug 2018-03-13 14:53:06 +01:00
hash Make the deprecated unstable SipHasher24 type private. 2018-03-17 11:07:02 +01:00
num Rollup merge of #50464 - est31:master, r=rkruppe 2018-05-09 20:29:44 +08:00
any.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00
array.rs Try to fix array TryFrom tests 2017-09-24 14:54:04 -04:00
ascii.rs Deprecate the AsciiExt trait in favor of inherent methods 2018-03-21 17:54:33 +01:00
atomic.rs std: Be sure to modify atomics in tests 2018-04-09 12:57:03 -07:00
cell.rs Add Cell::update 2018-04-06 15:15:28 +02:00
char.rs Deprecate Read::chars and char::decode_utf8 2018-04-15 08:18:00 +02:00
clone.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00
cmp.rs Add max and min default fns to Ord trait 2017-06-06 22:42:48 -04:00
intrinsics.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00
iter.rs Add Iterator::find_map 2018-04-03 00:47:00 +03:00
lib.rs Some final touches to ensure ./x.py test --stage 0 src/lib* works 2018-05-06 02:34:07 +08:00
mem.rs core: Ensure std::mem::Discriminant is Send + Sync 2017-10-08 01:09:55 +02:00
nonzero.rs Test NonZero in a const item in a pattern. 2018-03-17 23:07:40 +01:00
ops.rs Removed direct field usage of RangeInclusive in rustc itself. 2018-05-01 01:45:18 +08:00
option.rs Rename option::Missing to NoneError 2017-09-27 17:57:07 -04:00
pattern.rs Regression tests for #47175 2018-01-06 11:17:12 +05:30
ptr.rs Mark Unique as perma-unstable, with the feature renamed to ptr_internals. 2018-01-20 11:09:23 +01:00
result.rs Rename option::Missing to NoneError 2017-09-27 17:57:07 -04:00
slice.rs Rollup merge of #50010 - ExpHP:slice-bounds, r=alexcrichton 2018-05-10 11:35:17 -05:00
str.rs update libcore's comment about str tests 2018-04-30 07:36:56 -04:00
str_lossy.rs Move Utf8Lossy decoder to libcore 2018-04-12 00:13:43 +02:00
time.rs Fix warning in core::time tests 2018-05-06 02:34:07 +08:00
tuple.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00