summaryrefslogtreecommitdiff
path: root/rust/tests
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2026-02-22 17:08:21 -0800
committerMason Reed <35282038+emesare@users.noreply.github.com>2026-02-23 00:09:44 -0800
commitb18bdad6c94a8e234108d531f0c480c7104abebe (patch)
treeb0edb86cfae52c37635ef0b5cac491220bc3ef24 /rust/tests
parentdbd54d67a6d523f64615f653d82d8224cd09870a (diff)
[Rust] Misc documentation and cleanup
Diffstat (limited to 'rust/tests')
-rw-r--r--rust/tests/binary_view.rs5
-rw-r--r--rust/tests/collaboration.rs5
-rw-r--r--rust/tests/function.rs2
-rw-r--r--rust/tests/initialization.rs6
-rw-r--r--rust/tests/type_container.rs6
-rw-r--r--rust/tests/types.rs3
6 files changed, 12 insertions, 15 deletions
diff --git a/rust/tests/binary_view.rs b/rust/tests/binary_view.rs
index 7a0a3299..11caf3d0 100644
--- a/rust/tests/binary_view.rs
+++ b/rust/tests/binary_view.rs
@@ -3,6 +3,7 @@ use binaryninja::binary_view::{
AnalysisProgress, AnalysisState, BinaryViewBase, BinaryViewExt, StringType,
};
use binaryninja::data_buffer::DataBuffer;
+use binaryninja::file_metadata::SaveSettings;
use binaryninja::function::{Function, FunctionViewType};
use binaryninja::headless::Session;
use binaryninja::main_thread::execute_on_main_thread_and_wait;
@@ -69,7 +70,9 @@ fn test_binary_saving_database() {
// Save the modified database.
let temp_dir = tempfile::tempdir().expect("Failed to create temporary directory");
let temp_path = temp_dir.path().join("atox.obj.bndb");
- assert!(view.file().create_database(&temp_path));
+ assert!(view
+ .file()
+ .create_database(&temp_path, &SaveSettings::new()));
// Verify that the file exists and is modified.
let new_view = binaryninja::load(temp_path).expect("Failed to load new view");
let new_entry_function = new_view
diff --git a/rust/tests/collaboration.rs b/rust/tests/collaboration.rs
index 529e185b..914935b5 100644
--- a/rust/tests/collaboration.rs
+++ b/rust/tests/collaboration.rs
@@ -1,5 +1,6 @@
use binaryninja::binary_view::BinaryViewExt;
use binaryninja::collaboration::{NoNameChangeset, Remote, RemoteFileType, RemoteProject};
+use binaryninja::file_metadata::SaveSettings;
use binaryninja::headless::Session;
use binaryninja::rc::Ref;
use binaryninja::symbol::{SymbolBuilder, SymbolType};
@@ -7,7 +8,6 @@ use rstest::*;
use serial_test::serial;
use std::env;
use std::path::PathBuf;
-
// TODO: Why cant we create_project for the same project name? why does that fail.
// TODO: Remote connection / disconnection is NOT thread safe, the core needs to lock on each.
// TODO: Because of this we run these tests serially, this isnt _really_ an issue for real code, as
@@ -182,7 +182,8 @@ fn test_project_sync() {
let view_type = view.view_type();
// Save the view to local database so that we can upload it
assert!(
- view.file().create_database(out_dir.join("atox.obj.bndb")),
+ view.file()
+ .create_database(out_dir.join("atox.obj.bndb"), &SaveSettings::new()),
"Failed to create local database"
);
// We should have a single snapshot.
diff --git a/rust/tests/function.rs b/rust/tests/function.rs
index ac15fd91..507b405d 100644
--- a/rust/tests/function.rs
+++ b/rust/tests/function.rs
@@ -116,7 +116,7 @@ fn add_function() {
// Make sure you cannot add a function without a default platform.
let code = &[0xa1, 0xfa, 0xf8, 0xf0, 0x99, 0x83, 0xc0, 0x37, 0xc3];
- let view = BinaryView::from_data(&FileMetadata::new(), code).expect("Failed to create view");
+ let view = BinaryView::from_data(&FileMetadata::new(), code);
assert!(view.add_user_function(0).is_none());
assert!(view.add_auto_function(0).is_none());
diff --git a/rust/tests/initialization.rs b/rust/tests/initialization.rs
index 69c0c191..e50a5c77 100644
--- a/rust/tests/initialization.rs
+++ b/rust/tests/initialization.rs
@@ -27,10 +27,6 @@ fn test_license_validation() {
// Actually make sure we can initialize.
init().expect("Failed to initialize, make sure you have a license before trying to run tests!");
// Open an empty binary and make sure it succeeds.
- let view = BinaryView::from_data(&FileMetadata::new(), &[]);
- assert!(
- view.is_ok(),
- "Failed to open empty binary, core initialization failed!"
- );
+ let _ = BinaryView::from_data(&FileMetadata::new(), &[]);
shutdown();
}
diff --git a/rust/tests/type_container.rs b/rust/tests/type_container.rs
index 96f3bc4a..a0916ef4 100644
--- a/rust/tests/type_container.rs
+++ b/rust/tests/type_container.rs
@@ -37,8 +37,7 @@ fn test_type_id() {
#[test]
fn test_add_delete_type() {
let _session = Session::new().expect("Failed to initialize session");
- let empty_view =
- BinaryView::from_data(&FileMetadata::new(), &[]).expect("Failed to create view");
+ let empty_view = BinaryView::from_data(&FileMetadata::new(), &[]);
let view_type_container = empty_view.type_container();
let test_type = Type::int(4, true);
assert!(
@@ -106,8 +105,7 @@ fn test_parse_type() {
fn test_container_lifetime() {
let _session = Session::new().expect("Failed to initialize session");
let platform = Platform::by_name("windows-x86_64").expect("windows-x86_64 exists");
- let empty_view =
- BinaryView::from_data(&FileMetadata::new(), &[]).expect("Failed to create view");
+ let empty_view = BinaryView::from_data(&FileMetadata::new(), &[]);
let plat_type_container_dropped = platform.type_container();
let view_type_container_dropped = empty_view.type_container();
let _plat_types_dropped = plat_type_container_dropped.types();
diff --git a/rust/tests/types.rs b/rust/tests/types.rs
index 962df630..c13a1c88 100644
--- a/rust/tests/types.rs
+++ b/rust/tests/types.rs
@@ -61,8 +61,7 @@ fn test_structure_builder() {
#[test]
fn add_type_to_view() {
let _session = Session::new().expect("Failed to initialize session");
- let empty_view =
- BinaryView::from_data(&FileMetadata::new(), &[]).expect("Failed to create view");
+ let empty_view = BinaryView::from_data(&FileMetadata::new(), &[]);
let test_type = Type::int(4, true);
empty_view.define_auto_type("test", "me", &test_type);
assert!(empty_view.type_by_name("test").is_some());