22 lines
364 B
Rust
22 lines
364 B
Rust
use subject_source::string::utf8::char_at;
|
|
|
|
#[test]
|
|
pub fn char_at_empty() {
|
|
assert_eq!(char_at("", 0), None);
|
|
}
|
|
|
|
#[test]
|
|
pub fn char_at_emoji() {
|
|
assert_eq!(char_at("🙂🙁", 1), Some('🙁'));
|
|
}
|
|
|
|
#[test]
|
|
pub fn char_at_oob() {
|
|
assert_eq!(char_at("abc", 3), None);
|
|
}
|
|
|
|
#[test]
|
|
pub fn char_at_ascii() {
|
|
assert_eq!(char_at("abc", 1), Some('b'));
|
|
}
|