From 371c13139553fd2300bda7fd200fff01f2fe9b33 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Mon, 17 Aug 2020 09:44:28 +0800 Subject: [PATCH] Fix CI. --- codegen/tests/test_functions.rs | 72 --------------------------------- 1 file changed, 72 deletions(-) diff --git a/codegen/tests/test_functions.rs b/codegen/tests/test_functions.rs index cfc73275..4a179376 100644 --- a/codegen/tests/test_functions.rs +++ b/codegen/tests/test_functions.rs @@ -160,78 +160,6 @@ fn mut_opaque_ref_test() -> Result<(), Box> { Ok(()) } -mod rename_fn { - use rhai::plugin::*; - use rhai::FLOAT; - - #[export_fn(name = "add_float")] - pub fn add(f1: FLOAT, f2: FLOAT) -> FLOAT { - f1 + f2 - } -} - -#[test] -fn rename_fn_test() -> Result<(), Box> { - let mut engine = Engine::new(); - engine.register_fn("get_mystic_number", || 42 as FLOAT); - let mut m = Module::new(); - rhai::set_exported_fn!(m, "add_two_floats", rename_fn::add_float); - let mut r = StaticModuleResolver::new(); - r.insert("Math::Advanced".to_string(), m); - engine.set_module_resolver(Some(r)); - - assert_eq!( - engine.eval::( - r#"import "Math::Advanced" as math; - let x = get_mystic_number(); - let y = math::add_two_floats(x, 1.0); - y"# - )?, - 43.0 - ); - Ok(()) -} - -mod duplicate_fn_rename { - use rhai::plugin::*; - use rhai::{FLOAT, INT}; - - #[export_fn(name = "add_float")] - pub fn add(f1: FLOAT, f2: FLOAT) -> FLOAT { - f1 + f2 - } - - #[export_fn(name = "add_int")] - pub fn add(i1: INT, i2: INT) -> INT { - i1 + i2 - } -} - -#[test] -fn duplicate_fn_rename_test() -> Result<(), Box> { - let mut engine = Engine::new(); - engine.register_fn("get_mystic_number", || 42 as FLOAT); - let mut m = Module::new(); - rhai::set_exported_fn!(m, "add_two_floats", duplicate_fn_rename::add_float); - rhai::set_exported_fn!(m, "add_two_ints", duplicate_fn_rename::add_int); - let mut r = StaticModuleResolver::new(); - r.insert("Math::Advanced".to_string(), m); - engine.set_module_resolver(Some(r)); - - let output_array = engine.eval::( - r#"import "Math::Advanced" as math; - let fx = get_mystic_number(); - let fy = math::add_two_floats(fx, 1.0); - let ix = 42; - let iy = math::add_two_ints(ix, 1); - [fy, iy] - "#, - )?; - assert_eq!(&output_array[0].as_float().unwrap(), &43.0); - assert_eq!(&output_array[1].as_int().unwrap(), &43); - Ok(()) -} - pub mod raw_returning_fn { use rhai::plugin::*; use rhai::FLOAT;