Refine docs and tests.
This commit is contained in:
@@ -32,7 +32,7 @@ fn test_call_fn() -> Result<(), Box<EvalAltResult>> {
|
||||
x + y
|
||||
}
|
||||
fn hello(x) {
|
||||
x = x * foo;
|
||||
x *= foo;
|
||||
foo = 1;
|
||||
x
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ fn test_loop() -> Result<(), Box<EvalAltResult>> {
|
||||
if i < 10 {
|
||||
i += 1;
|
||||
if x > 20 { continue; }
|
||||
x = x + i;
|
||||
x += i;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ fn test_var_scope() -> Result<(), Box<EvalAltResult>> {
|
||||
|
||||
engine.eval_with_scope::<()>(&mut scope, "let x = 4 + 5")?;
|
||||
assert_eq!(engine.eval_with_scope::<INT>(&mut scope, "x")?, 9);
|
||||
engine.eval_with_scope::<()>(&mut scope, "x = x + 1; x = x + 2;")?;
|
||||
engine.eval_with_scope::<()>(&mut scope, "x += 1; x += 2;")?;
|
||||
assert_eq!(engine.eval_with_scope::<INT>(&mut scope, "x")?, 12);
|
||||
|
||||
scope.set_value("x", 42 as INT);
|
||||
|
@@ -10,10 +10,10 @@ fn test_while() -> Result<(), Box<EvalAltResult>> {
|
||||
let x = 0;
|
||||
|
||||
while x < 10 {
|
||||
x = x + 1;
|
||||
x += 1;
|
||||
if x > 5 { break; }
|
||||
if x > 3 { continue; }
|
||||
x = x + 3;
|
||||
x += 3;
|
||||
}
|
||||
|
||||
x
|
||||
|
Reference in New Issue
Block a user