Clippy fixes, additional WASM registration work
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-08-26 18:23:35 +02:00
parent 1e43c07d43
commit c5fb81c179
22 changed files with 219 additions and 101 deletions

View File

@@ -36,14 +36,13 @@ pub fn load_library() -> DynamicLibrary {
let mut resolver = WebAssemblyScriptResolver::new();
load_wasm(&path, resolver.as_mut());
let dynamic = DynamicLibrary::new(
DynamicLibrary::new(
data,
Box::new(Gen7BattleStatCalculator {}),
Box::new(Gen7DamageLibrary::new(false)),
Box::new(Gen7MiscLibrary::new()),
resolver,
);
dynamic
)
}
pub fn load_types(path: &String, type_library: &mut TypeLibrary) {

View File

@@ -18,7 +18,7 @@ pub mod common;
static LIBRARY: OnceCell<Arc<DynamicLibrary>> = OnceCell::uninit();
fn get_library<'a>() -> Arc<DynamicLibrary> {
fn get_library() -> Arc<DynamicLibrary> {
LIBRARY
.get_or_init(|| {
let start_time = chrono::Utc::now();
@@ -47,7 +47,7 @@ fn integration_tests(input: &Path) {
let mut str: String = "".to_string();
let mut file = File::open(input).unwrap();
file.read_to_string(&mut str).unwrap();
let test_case = serde_yaml::from_str::<TestCase>(&*str).unwrap();
let test_case = serde_yaml::from_str::<TestCase>(&str).unwrap();
println!("\tRunning integration test {}", test_case.name);
test_case.run_test(get_library());
}
@@ -57,7 +57,7 @@ fn integration_tests(input: &Path) {
fn validate_script() {
let lib = get_library();
let script = lib
.load_script(0 as *const u8, ScriptCategory::Move, &"test".into())
.load_script(std::ptr::null(), ScriptCategory::Move, &"test".into())
.unwrap()
.unwrap();
let parameters = [EffectParameter::String("foo".into())];
@@ -71,7 +71,7 @@ fn validate_script() {
fn validate_script_2() {
let lib = get_library();
let script = lib
.load_script(0 as *const u8, ScriptCategory::Move, &"test".into())
.load_script(std::ptr::null(), ScriptCategory::Move, &"test".into())
.unwrap()
.unwrap();
let user = Arc::new(