Lines
100 %
Functions
Branches
use std::collections::HashSet;
use super::{check, offenders, registry};
#[test]
fn the_trigger_linker_binds_no_registry_native() {
let (imports, findings) = check();
assert_eq!(findings, []);
assert!(imports > 0);
assert!(!registry().is_empty());
}
fn a_linked_registry_native_is_reported() {
let get_account = ("nomi".to_string(), "account_get_account".to_string());
let env = ("env".to_string(), "write_bytes".to_string());
let registry = HashSet::from([get_account.clone()]);
let findings = offenders(&[env, get_account], ®istry);
assert_eq!(findings.len(), 1);
assert!(findings[0].reason.contains("nomi.account_get_account"));
fn the_registry_holds_the_lookup_natives() {
let lookups = ["GET-ACCOUNT", "GET-COMMODITY"];
let names: Vec<_> = crate::natives::all_compiler_specs()
.into_iter()
.map(|spec| spec.nomi_name)
.collect();
assert!(lookups.iter().all(|name| names.iter().any(|n| n == name)));