Rollup merge of #146477 - ferrocene:pvdrz/improve-char-coverage, r=Noratrieb
Improve `core::char` coverage This PR improves the `core::char` coverage by adding new tests to `coretests` r? ``@workingjubilee``
This commit is contained in:
commit
7928be014c
2 changed files with 44 additions and 0 deletions
|
|
@ -220,6 +220,7 @@ fn test_escape_default() {
|
|||
}
|
||||
assert_eq!(string('\n'), "\\n");
|
||||
assert_eq!(string('\r'), "\\r");
|
||||
assert_eq!(string('\t'), "\\t");
|
||||
assert_eq!(string('\''), "\\'");
|
||||
assert_eq!(string('"'), "\\\"");
|
||||
assert_eq!(string(' '), " ");
|
||||
|
|
@ -417,3 +418,45 @@ fn eu_iterator_specializations() {
|
|||
check('\u{12340}');
|
||||
check('\u{10FFFF}');
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_from_digit_radix_too_high() {
|
||||
let _ = char::from_digit(0, 37);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_digit_invalid_radix() {
|
||||
assert!(char::from_digit(10, 9).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_to_digit_radix_too_low() {
|
||||
let _ = 'a'.to_digit(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_to_digit_radix_too_high() {
|
||||
let _ = 'a'.to_digit(37);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_as_ascii_invalid() {
|
||||
assert!('❤'.as_ascii().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_encode_utf8_raw_buffer_too_small() {
|
||||
let mut buf = [0u8; 1];
|
||||
let _ = char::encode_utf8_raw('ß'.into(), &mut buf);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn test_encode_utf16_raw_buffer_too_small() {
|
||||
let mut buf = [0u16; 1];
|
||||
let _ = char::encode_utf16_raw('𐐷'.into(), &mut buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#![feature(bool_to_result)]
|
||||
#![feature(bstr)]
|
||||
#![feature(cfg_target_has_reliable_f16_f128)]
|
||||
#![feature(char_internals)]
|
||||
#![feature(char_max_len)]
|
||||
#![feature(clone_to_uninit)]
|
||||
#![feature(const_cmp)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue