summaryrefslogtreecommitdiff
path: root/rust/tests/binary_view.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-04 19:10:56 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commita826c589dfc10c542deba7ca3343a462e02d6bde (patch)
treef116254bef39f787268bbecc5eac19da310db9ce /rust/tests/binary_view.rs
parent28b3c4044af06fdc32c9c85bf8381b5058306427 (diff)
[Rust] Simplify `BnStrCompatible` trait
Followup to https://github.com/Vector35/binaryninja-api/pull/5897/ This simplifies usage of the trait in user code, should just be able to `to_cstr` to get the cstr repr and then call `as_ptr`. Co-authored-by: Michael Krasnitski <michael.krasnitski@gmail.com>
Diffstat (limited to 'rust/tests/binary_view.rs')
-rw-r--r--rust/tests/binary_view.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/rust/tests/binary_view.rs b/rust/tests/binary_view.rs
index e48d5f52..a2407253 100644
--- a/rust/tests/binary_view.rs
+++ b/rust/tests/binary_view.rs
@@ -29,7 +29,7 @@ fn test_binary_saving() {
let modified_contents = view.read_vec(contents_addr, 4);
assert_eq!(modified_contents, [0xff, 0xff, 0xff, 0xff]);
- // HACK: To prevent us from deadlocking in save_to_path we wait for all main thread actions to finish.
+ // HACK: To prevent us from deadlocking in save_to_path, we wait for all main thread actions to finish.
execute_on_main_thread_and_wait(|| {});
// Save the modified file
@@ -56,7 +56,7 @@ fn test_binary_saving_database() {
SymbolBuilder::new(SymbolType::Function, "test", entry_function.start()).create();
view.define_user_symbol(&new_entry_func_symbol);
// Verify that we modified the binary
- assert_eq!(entry_function.symbol().raw_name().as_str(), "test");
+ assert_eq!(entry_function.symbol().raw_name().to_string_lossy(), "test");
// Save the modified database.
assert!(view.file().create_database(out_dir.join("atox.obj.bndb")));
// Verify that the file exists and is modified.
@@ -65,5 +65,8 @@ fn test_binary_saving_database() {
let new_entry_function = new_view
.entry_point_function()
.expect("Failed to get entry point function");
- assert_eq!(new_entry_function.symbol().raw_name().as_str(), "test");
+ assert_eq!(
+ new_entry_function.symbol().raw_name().to_string_lossy(),
+ "test"
+ );
}