Change codegen tests for return_raw.

This commit is contained in:
Stephen Chung 2021-03-22 19:21:42 +08:00
parent 42d7736d94
commit 39fb78293c
4 changed files with 8 additions and 13 deletions

View File

@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0"
proc-macro = true
[dev-dependencies]
rhai = { path = "..", version = "0.19.15" }
rhai = { path = "..", version = "^0.19.15" }
trybuild = "1"
[dependencies]

View File

@ -1,4 +1,3 @@
use rhai::module_resolvers::*;
use rhai::plugin::*;
use rhai::{Engine, EvalAltResult, Module, FLOAT};
@ -152,10 +151,8 @@ pub mod raw_returning_fn {
y1: FLOAT,
x2: FLOAT,
y2: FLOAT,
) -> Result<rhai::Dynamic, Box<rhai::EvalAltResult>> {
Ok(Dynamic::from(
((y2 - y1).abs().powf(2.0) + (x2 - x1).abs().powf(2.0)).sqrt(),
))
) -> Result<rhai::FLOAT, Box<rhai::EvalAltResult>> {
Ok(((y2 - y1).abs().powf(2.0) + (x2 - x1).abs().powf(2.0)).sqrt())
}
}

View File

@ -1,4 +1,3 @@
use rhai::module_resolvers::*;
use rhai::{Array, Engine, EvalAltResult, FLOAT, INT};
pub mod empty_module {

View File

@ -1,5 +1,4 @@
use rhai::module_resolvers::*;
use rhai::{Array, Engine, EvalAltResult, FLOAT, INT};
use rhai::{Array, Engine, EvalAltResult, FLOAT};
pub mod one_fn_module_nested_attr {
use rhai::plugin::*;
@ -10,8 +9,8 @@ pub mod one_fn_module_nested_attr {
use rhai::FLOAT;
#[rhai_fn(return_raw)]
pub fn get_mystic_number() -> Result<Dynamic, Box<EvalAltResult>> {
Ok(Dynamic::from(42.0 as FLOAT))
pub fn get_mystic_number() -> Result<FLOAT, Box<EvalAltResult>> {
Ok(42.0)
}
}
}
@ -39,8 +38,8 @@ pub mod one_fn_sub_module_nested_attr {
use rhai::plugin::*;
use rhai::FLOAT;
#[rhai_fn(return_raw)]
pub fn get_mystic_number() -> Result<Dynamic, Box<EvalAltResult>> {
Ok(Dynamic::from(42.0 as FLOAT))
pub fn get_mystic_number() -> Result<FLOAT, Box<EvalAltResult>> {
Ok(42.0)
}
}
}