diff options
| author | Christiaan Dirkx <christiaan@dirkx.email> | 2020-09-04 02:35:27 +0200 |
|---|---|---|
| committer | Christiaan Dirkx <christiaan@dirkx.email> | 2020-09-04 02:35:27 +0200 |
| commit | 538e198193451e680cc95b66c82baac3ac687c8c (patch) | |
| tree | 681bc99a51195deb0c9869a95d804839e1398e4c /library/core/tests/ascii.rs | |
| parent | 0d0f6b113047b2cf9afbde990cee30fd5b866469 (diff) | |
| download | rust-538e198193451e680cc95b66c82baac3ac687c8c.tar.gz rust-538e198193451e680cc95b66c82baac3ac687c8c.zip | |
Move various ui const tests to `library`
Move: - `src\test\ui\consts\const-nonzero.rs` to `library\core` - `src\test\ui\consts\ascii.rs` to `library\core` - `src\test\ui\consts\cow-is-borrowed` to `library\alloc` Part of #76268
Diffstat (limited to 'library/core/tests/ascii.rs')
| -rw-r--r-- | library/core/tests/ascii.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/library/core/tests/ascii.rs b/library/core/tests/ascii.rs index 0b975083947..3244bbc2d67 100644 --- a/library/core/tests/ascii.rs +++ b/library/core/tests/ascii.rs @@ -397,3 +397,14 @@ fn test_is_ascii_align_size_thoroughly() { } } } + +#[test] +fn ascii_const() { + // test that the `is_ascii` methods of `char` and `u8` are usable in a const context + + const CHAR_IS_ASCII: bool = 'a'.is_ascii(); + assert!(CHAR_IS_ASCII); + + const BYTE_IS_ASCII: bool = 97u8.is_ascii(); + assert!(BYTE_IS_ASCII); +} |
