test: add test case for highlight unsafe operations
This commit is contained in:
parent
f6f92a22ba
commit
9031c86009
1 changed files with 28 additions and 0 deletions
|
|
@ -811,6 +811,34 @@ mod tests {
|
|||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hl_unsafe_block() {
|
||||
check(
|
||||
r#"
|
||||
fn foo() {
|
||||
unsafe fn this_is_unsafe_function() {
|
||||
}
|
||||
|
||||
|
||||
unsa$0fe {
|
||||
//^^^^^^
|
||||
let raw_ptr = &42 as *const i32;
|
||||
let val = *raw_ptr;
|
||||
//^^^^^^^^
|
||||
|
||||
let mut_ptr = &mut 5 as *mut i32;
|
||||
*mut_ptr = 10;
|
||||
//^^^^^^^^
|
||||
|
||||
this_is_unsafe_function();
|
||||
//^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_hl_tuple_fields() {
|
||||
check(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue