Fix tests.
This commit is contained in:
parent
fcdd2eb143
commit
d7dfa1a218
@ -77,11 +77,19 @@ fn test_native_overload() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
assert_eq!(
|
||||
engine.eval::<String>(r#"let x = "hello"; let y = "world"; x + y"#)?,
|
||||
if cfg!(not(feature = "fast_ops")) {
|
||||
"hello***world"
|
||||
} else {
|
||||
"helloworld"
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
engine.eval::<String>(r#"let x = "hello"; let y = (); x + y"#)?,
|
||||
if cfg!(not(feature = "fast_ops")) {
|
||||
"hello Foo!"
|
||||
} else {
|
||||
"hello"
|
||||
}
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
@ -80,6 +80,7 @@ macro_rules! expand_enum {
|
||||
#[export_module]
|
||||
pub mod $module {
|
||||
$(
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const $variant: $typ = <$typ>::$variant;
|
||||
)*
|
||||
}
|
||||
@ -127,7 +128,14 @@ fn test_plugins_package() -> Result<(), Box<EvalAltResult>> {
|
||||
assert_eq!(engine.eval::<INT>("let a = [1, 2, 3]; test(a, 2)")?, 6);
|
||||
assert_eq!(engine.eval::<INT>("let a = [1, 2, 3]; hi(a, 2)")?, 6);
|
||||
assert_eq!(engine.eval::<INT>("let a = [1, 2, 3]; test(a, 2)")?, 6);
|
||||
assert_eq!(engine.eval::<INT>("2 + 2")?, 5);
|
||||
assert_eq!(
|
||||
engine.eval::<INT>("2 + 2")?,
|
||||
if cfg!(not(feature = "fast_ops")) {
|
||||
5
|
||||
} else {
|
||||
4
|
||||
}
|
||||
);
|
||||
assert_eq!(
|
||||
engine.eval::<String>("let a = [1, 2, 3]; greet(test(a, 2))")?,
|
||||
"6 kitties"
|
||||
|
Loading…
Reference in New Issue
Block a user