Make sure all tests run with all features.

This commit is contained in:
Stephen Chung
2020-03-10 19:48:47 +08:00
parent cc772c6e2a
commit e22aaca5c1
14 changed files with 71 additions and 38 deletions

View File

@@ -274,6 +274,8 @@ impl<'e> Engine<'e> {
///
/// ```rust
/// # fn main() -> Result<(), rhai::EvalAltResult> {
/// # #[cfg(not(feature = "no_stdlib"))]
/// # {
/// use rhai::Engine;
///
/// let mut engine = Engine::new();
@@ -283,6 +285,7 @@ impl<'e> Engine<'e> {
/// let result: i64 = engine.call_fn("add", &ast, (String::from("abc"), 123_i64))?;
///
/// assert_eq!(result, 126);
/// # }
/// # Ok(())
/// # }
/// ```

View File

@@ -479,7 +479,7 @@ impl Engine<'_> {
reg_func1!(self, "debug", print_debug, String, i8, u8, i16, u16);
reg_func1!(self, "debug", print_debug, String, i32, i64, u32, u64);
reg_func1!(self, "debug", print_debug, String, bool, char);
reg_func1!(self, "debug", print_debug, String, bool, char, String, ());
#[cfg(not(feature = "no_float"))]
{
@@ -490,7 +490,7 @@ impl Engine<'_> {
#[cfg(not(feature = "no_index"))]
{
reg_func1!(self, "print", print_debug, String, Array);
reg_func1!(self, "debug", print_debug, String, String, Array, ());
reg_func1!(self, "debug", print_debug, String, Array);
// Register array iterator
self.register_iterator::<Array, _>(|a| {

View File

@@ -61,7 +61,7 @@ fn optimize_stmt(stmt: Stmt, changed: &mut bool) -> Stmt {
// Remove all raw expression statements that evaluate to constants
// except for the very last statement
result.retain(|stmt| match stmt {
Stmt::Expr(expr) if expr.is_constant() => false,
Stmt::Expr(expr) if expr.is_constant() || expr.is_identifier() => false,
_ => true,
});