Do not unnecessarily use raw strings.
This commit is contained in:
parent
a186eb8d97
commit
0f66c67f82
@ -25,7 +25,7 @@ fn main() -> Result<(), Box<EvalAltResult>> {
|
|||||||
.register_fn("update", TestStruct::update);
|
.register_fn("update", TestStruct::update);
|
||||||
|
|
||||||
let result = engine.eval::<TestStruct>(
|
let result = engine.eval::<TestStruct>(
|
||||||
r"
|
"
|
||||||
let x = new_ts();
|
let x = new_ts();
|
||||||
x.update();
|
x.update();
|
||||||
x
|
x
|
||||||
@ -35,7 +35,7 @@ fn main() -> Result<(), Box<EvalAltResult>> {
|
|||||||
println!("{:?}", result);
|
println!("{:?}", result);
|
||||||
|
|
||||||
let result = engine.eval::<TestStruct>(
|
let result = engine.eval::<TestStruct>(
|
||||||
r"
|
"
|
||||||
let x = [ new_ts() ];
|
let x = [ new_ts() ];
|
||||||
x[0].update();
|
x[0].update();
|
||||||
x[0]
|
x[0]
|
||||||
|
@ -25,7 +25,7 @@ fn main() -> Result<(), Box<EvalAltResult>> {
|
|||||||
.register_fn("update", TestStruct::update);
|
.register_fn("update", TestStruct::update);
|
||||||
|
|
||||||
let result = engine.eval::<TestStruct>(
|
let result = engine.eval::<TestStruct>(
|
||||||
r"
|
"
|
||||||
let x = new_ts();
|
let x = new_ts();
|
||||||
x.update();
|
x.update();
|
||||||
x
|
x
|
||||||
|
@ -1802,7 +1802,7 @@ impl Engine {
|
|||||||
///
|
///
|
||||||
/// let engine = Engine::new();
|
/// let engine = Engine::new();
|
||||||
///
|
///
|
||||||
/// let ast = engine.compile(r"
|
/// let ast = engine.compile("
|
||||||
/// fn add(x, y) { len(x) + y + foo }
|
/// fn add(x, y) { len(x) + y + foo }
|
||||||
/// fn add1(x) { len(x) + 1 + foo }
|
/// fn add1(x) { len(x) + 1 + foo }
|
||||||
/// fn bar() { foo/2 }
|
/// fn bar() { foo/2 }
|
||||||
@ -1873,7 +1873,7 @@ impl Engine {
|
|||||||
///
|
///
|
||||||
/// let engine = Engine::new();
|
/// let engine = Engine::new();
|
||||||
///
|
///
|
||||||
/// let ast = engine.compile(r"
|
/// let ast = engine.compile("
|
||||||
/// fn add(x, y) { len(x) + y + foo }
|
/// fn add(x, y) { len(x) + y + foo }
|
||||||
/// fn add1(x) { len(x) + 1 + foo }
|
/// fn add1(x) { len(x) + 1 + foo }
|
||||||
/// fn bar() { foo/2 }
|
/// fn bar() { foo/2 }
|
||||||
|
@ -56,7 +56,7 @@ fn test_arrays() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
convert_to_vec::<INT>(engine.eval(
|
convert_to_vec::<INT>(engine.eval(
|
||||||
r"
|
"
|
||||||
let x = [2, 9];
|
let x = [2, 9];
|
||||||
x.insert(-1, 1);
|
x.insert(-1, 1);
|
||||||
x.insert(999, 3);
|
x.insert(999, 3);
|
||||||
@ -76,7 +76,7 @@ fn test_arrays() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
convert_to_vec::<INT>(engine.eval(
|
convert_to_vec::<INT>(engine.eval(
|
||||||
r"
|
"
|
||||||
let x = [1, 2, 3];
|
let x = [1, 2, 3];
|
||||||
x += [4, 5];
|
x += [4, 5];
|
||||||
x
|
x
|
||||||
@ -86,7 +86,7 @@ fn test_arrays() -> Result<(), Box<EvalAltResult>> {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
convert_to_vec::<INT>(engine.eval(
|
convert_to_vec::<INT>(engine.eval(
|
||||||
r"
|
"
|
||||||
let x = [1, 2, 3];
|
let x = [1, 2, 3];
|
||||||
let y = [4, 5];
|
let y = [4, 5];
|
||||||
x + y
|
x + y
|
||||||
@ -136,7 +136,7 @@ fn test_array_with_structs() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let a = [new_ts()];
|
let a = [new_ts()];
|
||||||
a[0].x = 100;
|
a[0].x = 100;
|
||||||
a[0].update();
|
a[0].update();
|
||||||
@ -158,7 +158,7 @@ fn test_arrays_map_reduce() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
convert_to_vec::<INT>(engine.eval(
|
convert_to_vec::<INT>(engine.eval(
|
||||||
r"
|
"
|
||||||
let x = [1, 2, 3];
|
let x = [1, 2, 3];
|
||||||
x.filter(|v| v > 2)
|
x.filter(|v| v > 2)
|
||||||
"
|
"
|
||||||
@ -168,7 +168,7 @@ fn test_arrays_map_reduce() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
convert_to_vec::<INT>(engine.eval(
|
convert_to_vec::<INT>(engine.eval(
|
||||||
r"
|
"
|
||||||
let x = [1, 2, 3];
|
let x = [1, 2, 3];
|
||||||
x.filter(|v, i| v > i)
|
x.filter(|v, i| v > i)
|
||||||
"
|
"
|
||||||
@ -178,7 +178,7 @@ fn test_arrays_map_reduce() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
convert_to_vec::<INT>(engine.eval(
|
convert_to_vec::<INT>(engine.eval(
|
||||||
r"
|
"
|
||||||
let x = [1, 2, 3];
|
let x = [1, 2, 3];
|
||||||
x.map(|v| v * 2)
|
x.map(|v| v * 2)
|
||||||
"
|
"
|
||||||
@ -188,7 +188,7 @@ fn test_arrays_map_reduce() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
convert_to_vec::<INT>(engine.eval(
|
convert_to_vec::<INT>(engine.eval(
|
||||||
r"
|
"
|
||||||
let x = [1, 2, 3];
|
let x = [1, 2, 3];
|
||||||
x.map(|v, i| v * i)
|
x.map(|v, i| v * i)
|
||||||
"
|
"
|
||||||
|
@ -21,41 +21,38 @@ fn test_assignments_bad_lhs() -> Result<(), Box<EvalAltResult>> {
|
|||||||
let engine = Engine::new();
|
let engine = Engine::new();
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine.compile(r"(x+y) = 42;").expect_err("should error").0,
|
*engine.compile("(x+y) = 42;").expect_err("should error").0,
|
||||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine.compile(r"foo(x) = 42;").expect_err("should error").0,
|
*engine.compile("foo(x) = 42;").expect_err("should error").0,
|
||||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine.compile(r"true = 42;").expect_err("should error").0,
|
*engine.compile("true = 42;").expect_err("should error").0,
|
||||||
ParseErrorType::AssignmentToConstant("".to_string())
|
ParseErrorType::AssignmentToConstant("".to_string())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine.compile(r"123 = 42;").expect_err("should error").0,
|
*engine.compile("123 = 42;").expect_err("should error").0,
|
||||||
ParseErrorType::AssignmentToConstant("".to_string())
|
ParseErrorType::AssignmentToConstant("".to_string())
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg(not(feature = "no_object"))]
|
#[cfg(not(feature = "no_object"))]
|
||||||
{
|
{
|
||||||
|
assert_eq!(
|
||||||
|
*engine.compile("x.foo() = 42;").expect_err("should error").0,
|
||||||
|
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine
|
*engine
|
||||||
.compile(r"x.foo() = 42;")
|
.compile("x.foo().x.y = 42;")
|
||||||
.expect_err("should error")
|
.expect_err("should error")
|
||||||
.0,
|
.0,
|
||||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine
|
*engine
|
||||||
.compile(r"x.foo().x.y = 42;")
|
.compile("x.y.z.foo() = 42;")
|
||||||
.expect_err("should error")
|
|
||||||
.0,
|
|
||||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
*engine
|
|
||||||
.compile(r"x.y.z.foo() = 42;")
|
|
||||||
.expect_err("should error")
|
.expect_err("should error")
|
||||||
.0,
|
.0,
|
||||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||||
@ -63,7 +60,7 @@ fn test_assignments_bad_lhs() -> Result<(), Box<EvalAltResult>> {
|
|||||||
#[cfg(not(feature = "no_index"))]
|
#[cfg(not(feature = "no_index"))]
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine
|
*engine
|
||||||
.compile(r"x.foo()[0] = 42;")
|
.compile("x.foo()[0] = 42;")
|
||||||
.expect_err("should error")
|
.expect_err("should error")
|
||||||
.0,
|
.0,
|
||||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||||
@ -71,7 +68,7 @@ fn test_assignments_bad_lhs() -> Result<(), Box<EvalAltResult>> {
|
|||||||
#[cfg(not(feature = "no_index"))]
|
#[cfg(not(feature = "no_index"))]
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine
|
*engine
|
||||||
.compile(r"x[y].z.foo() = 42;")
|
.compile("x[y].z.foo() = 42;")
|
||||||
.expect_err("should error")
|
.expect_err("should error")
|
||||||
.0,
|
.0,
|
||||||
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
ParseErrorType::AssignmentToInvalidLHS("".to_string())
|
||||||
|
@ -38,7 +38,7 @@ fn test_bool_op_short_circuit() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<bool>(
|
engine.eval::<bool>(
|
||||||
r"
|
"
|
||||||
let x = true;
|
let x = true;
|
||||||
x || { throw; };
|
x || { throw; };
|
||||||
"
|
"
|
||||||
@ -48,7 +48,7 @@ fn test_bool_op_short_circuit() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<bool>(
|
engine.eval::<bool>(
|
||||||
r"
|
"
|
||||||
let x = false;
|
let x = false;
|
||||||
x && { throw; };
|
x && { throw; };
|
||||||
"
|
"
|
||||||
@ -65,7 +65,7 @@ fn test_bool_op_no_short_circuit1() {
|
|||||||
|
|
||||||
assert!(engine
|
assert!(engine
|
||||||
.eval::<bool>(
|
.eval::<bool>(
|
||||||
r"
|
"
|
||||||
let x = true;
|
let x = true;
|
||||||
x | { throw; }
|
x | { throw; }
|
||||||
"
|
"
|
||||||
@ -79,7 +79,7 @@ fn test_bool_op_no_short_circuit2() {
|
|||||||
|
|
||||||
assert!(engine
|
assert!(engine
|
||||||
.eval::<bool>(
|
.eval::<bool>(
|
||||||
r"
|
"
|
||||||
let x = false;
|
let x = false;
|
||||||
x & { throw; }
|
x & { throw; }
|
||||||
"
|
"
|
||||||
|
@ -10,7 +10,7 @@ fn test_call_fn() -> Result<(), Box<EvalAltResult>> {
|
|||||||
scope.push("foo", 42 as INT);
|
scope.push("foo", 42 as INT);
|
||||||
|
|
||||||
let ast = engine.compile(
|
let ast = engine.compile(
|
||||||
r"
|
"
|
||||||
fn hello(x, y) {
|
fn hello(x, y) {
|
||||||
x + y
|
x + y
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ fn test_chars() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(engine.eval::<char>("'y'")?, 'y');
|
assert_eq!(engine.eval::<char>("'y'")?, 'y');
|
||||||
assert_eq!(engine.eval::<char>(r"'\''")?, '\'');
|
assert_eq!(engine.eval::<char>(r"'\''")?, '\'');
|
||||||
assert_eq!(engine.eval::<char>(r#"'"'"#)?, '"');
|
assert_eq!(engine.eval::<char>(r#"'"'"#)?, '"');
|
||||||
assert_eq!(engine.eval::<char>("'\\u2764'")?, '❤');
|
assert_eq!(engine.eval::<char>(r"'\u2764'")?, '❤');
|
||||||
|
|
||||||
#[cfg(not(feature = "no_index"))]
|
#[cfg(not(feature = "no_index"))]
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ fn test_closures() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let foo = #{ x: 42 };
|
let foo = #{ x: 42 };
|
||||||
let f = || { this.x };
|
let f = || { this.x };
|
||||||
foo.call(f)
|
foo.call(f)
|
||||||
|
@ -33,7 +33,7 @@ fn test_comments_doc() -> Result<(), Box<EvalAltResult>> {
|
|||||||
let mut engine = Engine::new();
|
let mut engine = Engine::new();
|
||||||
|
|
||||||
let ast = engine.compile(
|
let ast = engine.compile(
|
||||||
r"
|
"
|
||||||
/// Hello world
|
/// Hello world
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ fn test_comments_doc() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert!(engine
|
assert!(engine
|
||||||
.compile(
|
.compile(
|
||||||
r"
|
"
|
||||||
/// Hello world
|
/// Hello world
|
||||||
let x = 42;
|
let x = 42;
|
||||||
"
|
"
|
||||||
@ -56,7 +56,7 @@ fn test_comments_doc() -> Result<(), Box<EvalAltResult>> {
|
|||||||
.is_err());
|
.is_err());
|
||||||
|
|
||||||
engine.compile(
|
engine.compile(
|
||||||
r"
|
"
|
||||||
///////////////
|
///////////////
|
||||||
let x = 42;
|
let x = 42;
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ fn test_comments_doc() -> Result<(), Box<EvalAltResult>> {
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
let ast = engine.compile(
|
let ast = engine.compile(
|
||||||
r"
|
"
|
||||||
/** Hello world
|
/** Hello world
|
||||||
** how are you?
|
** how are you?
|
||||||
**/
|
**/
|
||||||
@ -82,7 +82,7 @@ fn test_comments_doc() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert!(engine
|
assert!(engine
|
||||||
.compile(
|
.compile(
|
||||||
r"
|
"
|
||||||
/** Hello world */
|
/** Hello world */
|
||||||
let x = 42;
|
let x = 42;
|
||||||
"
|
"
|
||||||
@ -92,7 +92,7 @@ fn test_comments_doc() -> Result<(), Box<EvalAltResult>> {
|
|||||||
engine.enable_doc_comments(false);
|
engine.enable_doc_comments(false);
|
||||||
|
|
||||||
engine.compile(
|
engine.compile(
|
||||||
r"
|
"
|
||||||
/// Hello world!
|
/// Hello world!
|
||||||
let x = 42;
|
let x = 42;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ fn test_constant_mut() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval_with_scope::<INT>(
|
engine.eval_with_scope::<INT>(
|
||||||
&mut scope,
|
&mut scope,
|
||||||
r"
|
"
|
||||||
MY_NUMBER.update_value(42);
|
MY_NUMBER.update_value(42);
|
||||||
MY_NUMBER.value
|
MY_NUMBER.value
|
||||||
",
|
",
|
||||||
|
@ -91,7 +91,7 @@ fn test_max_array_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.eval::<Array>(
|
.eval::<Array>(
|
||||||
r"
|
"
|
||||||
let x = [1,2,3,4,5,6];
|
let x = [1,2,3,4,5,6];
|
||||||
let y = [7,8,9,10,11,12];
|
let y = [7,8,9,10,11,12];
|
||||||
x + y
|
x + y
|
||||||
@ -105,7 +105,7 @@ fn test_max_array_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.eval::<Array>(
|
.eval::<Array>(
|
||||||
r"
|
"
|
||||||
let x = [1,2,3,4,5,6];
|
let x = [1,2,3,4,5,6];
|
||||||
x.pad(100, 42);
|
x.pad(100, 42);
|
||||||
x
|
x
|
||||||
@ -118,7 +118,7 @@ fn test_max_array_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.eval::<Array>(
|
.eval::<Array>(
|
||||||
r"
|
"
|
||||||
let x = [1,2,3];
|
let x = [1,2,3];
|
||||||
[x, x, x, x]
|
[x, x, x, x]
|
||||||
"
|
"
|
||||||
@ -131,7 +131,7 @@ fn test_max_array_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.eval::<Array>(
|
.eval::<Array>(
|
||||||
r"
|
"
|
||||||
let x = #{a:1, b:2, c:3};
|
let x = #{a:1, b:2, c:3};
|
||||||
[x, x, x, x]
|
[x, x, x, x]
|
||||||
"
|
"
|
||||||
@ -143,7 +143,7 @@ fn test_max_array_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.eval::<Array>(
|
.eval::<Array>(
|
||||||
r"
|
"
|
||||||
let x = [1];
|
let x = [1];
|
||||||
let y = [x, x];
|
let y = [x, x];
|
||||||
let z = [y, y];
|
let z = [y, y];
|
||||||
@ -159,7 +159,7 @@ fn test_max_array_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine
|
engine
|
||||||
.eval::<Array>(
|
.eval::<Array>(
|
||||||
r"
|
"
|
||||||
let x = [1,2,3,4,5,6];
|
let x = [1,2,3,4,5,6];
|
||||||
let y = [7,8,9,10,11,12];
|
let y = [7,8,9,10,11,12];
|
||||||
x + y
|
x + y
|
||||||
@ -172,7 +172,7 @@ fn test_max_array_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine
|
engine
|
||||||
.eval::<Array>(
|
.eval::<Array>(
|
||||||
r"
|
"
|
||||||
let x = [1,2,3];
|
let x = [1,2,3];
|
||||||
[x, x, x, x]
|
[x, x, x, x]
|
||||||
"
|
"
|
||||||
@ -209,7 +209,7 @@ fn test_max_map_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.eval::<Map>(
|
.eval::<Map>(
|
||||||
r"
|
"
|
||||||
let x = #{a:1,b:2,c:3,d:4,e:5,f:6};
|
let x = #{a:1,b:2,c:3,d:4,e:5,f:6};
|
||||||
let y = #{g:7,h:8,i:9,j:10,k:11,l:12};
|
let y = #{g:7,h:8,i:9,j:10,k:11,l:12};
|
||||||
x + y
|
x + y
|
||||||
@ -222,7 +222,7 @@ fn test_max_map_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.eval::<Map>(
|
.eval::<Map>(
|
||||||
r"
|
"
|
||||||
let x = #{a:1,b:2,c:3};
|
let x = #{a:1,b:2,c:3};
|
||||||
#{u:x, v:x, w:x, z:x}
|
#{u:x, v:x, w:x, z:x}
|
||||||
"
|
"
|
||||||
@ -235,7 +235,7 @@ fn test_max_map_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.eval::<Map>(
|
.eval::<Map>(
|
||||||
r"
|
"
|
||||||
let x = [1, 2, 3];
|
let x = [1, 2, 3];
|
||||||
#{u:x, v:x, w:x, z:x}
|
#{u:x, v:x, w:x, z:x}
|
||||||
"
|
"
|
||||||
@ -249,7 +249,7 @@ fn test_max_map_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine
|
engine
|
||||||
.eval::<Map>(
|
.eval::<Map>(
|
||||||
r"
|
"
|
||||||
let x = #{a:1,b:2,c:3,d:4,e:5,f:6};
|
let x = #{a:1,b:2,c:3,d:4,e:5,f:6};
|
||||||
let y = #{g:7,h:8,i:9,j:10,k:11,l:12};
|
let y = #{g:7,h:8,i:9,j:10,k:11,l:12};
|
||||||
x + y
|
x + y
|
||||||
@ -262,7 +262,7 @@ fn test_max_map_size() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine
|
engine
|
||||||
.eval::<Map>(
|
.eval::<Map>(
|
||||||
r"
|
"
|
||||||
let x = #{a:1,b:2,c:3};
|
let x = #{a:1,b:2,c:3};
|
||||||
#{u:x, v:x, w:x, z:x}
|
#{u:x, v:x, w:x, z:x}
|
||||||
"
|
"
|
||||||
|
14
tests/for.rs
14
tests/for.rs
@ -5,7 +5,7 @@ use rhai::{Engine, EvalAltResult, Module, INT};
|
|||||||
fn test_for() -> Result<(), Box<EvalAltResult>> {
|
fn test_for() -> Result<(), Box<EvalAltResult>> {
|
||||||
let engine = Engine::new();
|
let engine = Engine::new();
|
||||||
|
|
||||||
let script = r"
|
let script = "
|
||||||
let sum1 = 0;
|
let sum1 = 0;
|
||||||
let sum2 = 0;
|
let sum2 = 0;
|
||||||
let inputs = [1, 2, 3, 4, 5];
|
let inputs = [1, 2, 3, 4, 5];
|
||||||
@ -29,7 +29,7 @@ fn test_for() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
for x in range(1, 10, 2) { sum += x; }
|
for x in range(1, 10, 2) { sum += x; }
|
||||||
sum
|
sum
|
||||||
@ -40,7 +40,7 @@ fn test_for() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
for x in range(10, 1, 2) { sum += x; }
|
for x in range(10, 1, 2) { sum += x; }
|
||||||
sum
|
sum
|
||||||
@ -51,7 +51,7 @@ fn test_for() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
for x in range(1, 10, -2) { sum += x; }
|
for x in range(1, 10, -2) { sum += x; }
|
||||||
sum
|
sum
|
||||||
@ -62,7 +62,7 @@ fn test_for() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
for x in range(10, 1, -2) { sum += x; }
|
for x in range(10, 1, -2) { sum += x; }
|
||||||
sum
|
sum
|
||||||
@ -80,7 +80,7 @@ fn test_for_overflow() -> Result<(), Box<EvalAltResult>> {
|
|||||||
let engine = Engine::new();
|
let engine = Engine::new();
|
||||||
|
|
||||||
#[cfg(not(feature = "only_i32"))]
|
#[cfg(not(feature = "only_i32"))]
|
||||||
let script = r"
|
let script = "
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
|
|
||||||
for x in range(9223372036854775807, 0, 9223372036854775807) {
|
for x in range(9223372036854775807, 0, 9223372036854775807) {
|
||||||
@ -90,7 +90,7 @@ fn test_for_overflow() -> Result<(), Box<EvalAltResult>> {
|
|||||||
sum
|
sum
|
||||||
";
|
";
|
||||||
#[cfg(feature = "only_i32")]
|
#[cfg(feature = "only_i32")]
|
||||||
let script = r"
|
let script = "
|
||||||
let sum = 0;
|
let sum = 0;
|
||||||
|
|
||||||
for x in range(2147483647 , 0, 2147483647 ) {
|
for x in range(2147483647 , 0, 2147483647 ) {
|
||||||
|
@ -67,7 +67,7 @@ fn test_functions_namespaces() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
const ANSWER = 42;
|
const ANSWER = 42;
|
||||||
|
|
||||||
fn foo() { global::ANSWER }
|
fn foo() { global::ANSWER }
|
||||||
|
@ -13,7 +13,7 @@ fn test_if() -> Result<(), Box<EvalAltResult>> {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
if false { 55 }
|
if false { 55 }
|
||||||
else if false { 33 }
|
else if false { 33 }
|
||||||
else if false { 66 }
|
else if false { 66 }
|
||||||
@ -34,7 +34,7 @@ fn test_if_expr() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let x = 42;
|
let x = 42;
|
||||||
let y = 1 + if x > 40 { 100 } else { 0 } / x;
|
let y = 1 + if x > 40 { 100 } else { 0 } / x;
|
||||||
y
|
y
|
||||||
|
@ -70,7 +70,7 @@ fn test_internal_fn_big() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
fn math_me(a, b, c, d, e, f) {
|
fn math_me(a, b, c, d, e, f) {
|
||||||
a - b * c + d * e - f
|
a - b * c + d * e - f
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ fn test_internal_fn_overloading() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
fn abc(x,y,z) { 2*x + 3*y + 4*z + 888 }
|
fn abc(x,y,z) { 2*x + 3*y + 4*z + 888 }
|
||||||
fn abc(x,y) { x + 2*y + 88 }
|
fn abc(x,y) { x + 2*y + 88 }
|
||||||
fn abc() { 42 }
|
fn abc() { 42 }
|
||||||
@ -104,7 +104,7 @@ fn test_internal_fn_overloading() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
*engine
|
*engine
|
||||||
.compile(
|
.compile(
|
||||||
r"
|
"
|
||||||
fn abc(x) { x + 42 }
|
fn abc(x) { x + 42 }
|
||||||
fn abc(x) { x - 42 }
|
fn abc(x) { x - 42 }
|
||||||
"
|
"
|
||||||
|
@ -6,7 +6,7 @@ fn test_loop() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let x = 0;
|
let x = 0;
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ b`: 1}; y["a\nb"]
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let x = #{a: 1, b: 2, c: 3};
|
let x = #{a: 1, b: 2, c: 3};
|
||||||
let y = #{b: 42, d: 9};
|
let y = #{b: 42, d: 9};
|
||||||
x.mixin(y);
|
x.mixin(y);
|
||||||
@ -83,7 +83,7 @@ b`: 1}; y["a\nb"]
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let x = #{a: 1, b: 2, c: 3};
|
let x = #{a: 1, b: 2, c: 3};
|
||||||
x += #{b: 42, d: 9};
|
x += #{b: 42, d: 9};
|
||||||
x.len() + x.b
|
x.len() + x.b
|
||||||
@ -94,7 +94,7 @@ b`: 1}; y["a\nb"]
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine
|
engine
|
||||||
.eval::<Map>(
|
.eval::<Map>(
|
||||||
r"
|
"
|
||||||
let x = #{a: 1, b: 2, c: 3};
|
let x = #{a: 1, b: 2, c: 3};
|
||||||
let y = #{b: 42, d: 9};
|
let y = #{b: 42, d: 9};
|
||||||
x + y
|
x + y
|
||||||
|
@ -30,7 +30,7 @@ fn test_mismatched_op_custom_type() -> Result<(), Box<EvalAltResult>> {
|
|||||||
.register_type_with_name::<TestStruct>("TestStruct")
|
.register_type_with_name::<TestStruct>("TestStruct")
|
||||||
.register_fn("new_ts", TestStruct::new);
|
.register_fn("new_ts", TestStruct::new);
|
||||||
|
|
||||||
assert!(matches!(*engine.eval::<bool>(r"
|
assert!(matches!(*engine.eval::<bool>("
|
||||||
let x = new_ts();
|
let x = new_ts();
|
||||||
let y = new_ts();
|
let y = new_ts();
|
||||||
x == y
|
x == y
|
||||||
|
@ -381,13 +381,13 @@ fn test_module_export() -> Result<(), Box<EvalAltResult>> {
|
|||||||
let engine = Engine::new();
|
let engine = Engine::new();
|
||||||
|
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
engine.compile(r"let x = 10; { export x; }").expect_err("should error"),
|
engine.compile("let x = 10; { export x; }").expect_err("should error"),
|
||||||
ParseError(x, _) if *x == ParseErrorType::WrongExport
|
ParseError(x, _) if *x == ParseErrorType::WrongExport
|
||||||
));
|
));
|
||||||
|
|
||||||
#[cfg(not(feature = "no_function"))]
|
#[cfg(not(feature = "no_function"))]
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
engine.compile(r"fn abc(x) { export x; }").expect_err("should error"),
|
engine.compile("fn abc(x) { export x; }").expect_err("should error"),
|
||||||
ParseError(x, _) if *x == ParseErrorType::WrongExport
|
ParseError(x, _) if *x == ParseErrorType::WrongExport
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ use rhai::{Engine, EvalAltResult, OptimizationLevel, INT};
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_optimizer_run() -> Result<(), Box<EvalAltResult>> {
|
fn test_optimizer_run() -> Result<(), Box<EvalAltResult>> {
|
||||||
fn run_test(engine: &mut Engine) -> Result<(), Box<EvalAltResult>> {
|
fn run_test(engine: &mut Engine) -> Result<(), Box<EvalAltResult>> {
|
||||||
assert_eq!(engine.eval::<INT>(r"if true { 42 } else { 123 }")?, 42);
|
assert_eq!(engine.eval::<INT>("if true { 42 } else { 123 }")?, 42);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(r"if 1 == 1 || 2 > 3 { 42 } else { 123 }")?,
|
engine.eval::<INT>("if 1 == 1 || 2 > 3 { 42 } else { 123 }")?,
|
||||||
42
|
42
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -34,14 +34,14 @@ fn test_optimizer_run() -> Result<(), Box<EvalAltResult>> {
|
|||||||
engine.set_optimization_level(OptimizationLevel::Simple);
|
engine.set_optimization_level(OptimizationLevel::Simple);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(r"if 1 == 1 || 2 > 3 { 42 } else { 123 }")?,
|
engine.eval::<INT>("if 1 == 1 || 2 > 3 { 42 } else { 123 }")?,
|
||||||
123
|
123
|
||||||
);
|
);
|
||||||
|
|
||||||
engine.set_optimization_level(OptimizationLevel::Full);
|
engine.set_optimization_level(OptimizationLevel::Full);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(r"if 1 == 1 || 2 > 3 { 42 } else { 123 }")?,
|
engine.eval::<INT>("if 1 == 1 || 2 > 3 { 42 } else { 123 }")?,
|
||||||
123
|
123
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ fn test_side_effects_command() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval_with_scope::<INT>(
|
engine.eval_with_scope::<INT>(
|
||||||
&mut scope,
|
&mut scope,
|
||||||
r"
|
"
|
||||||
// Drive the command object via the wrapper
|
// Drive the command object via the wrapper
|
||||||
Command.action(30);
|
Command.action(30);
|
||||||
Command.value
|
Command.value
|
||||||
|
File diff suppressed because one or more lines are too long
@ -319,7 +319,7 @@ fn test_string_interpolated() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<String>(
|
engine.eval::<String>(
|
||||||
r"
|
"
|
||||||
let x = 40;
|
let x = 40;
|
||||||
`hello ${x+2} worlds!`
|
`hello ${x+2} worlds!`
|
||||||
"
|
"
|
||||||
@ -339,7 +339,7 @@ fn test_string_interpolated() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<String>(
|
engine.eval::<String>(
|
||||||
r"
|
"
|
||||||
const x = 42;
|
const x = 42;
|
||||||
`hello ${x} worlds!`
|
`hello ${x} worlds!`
|
||||||
"
|
"
|
||||||
@ -351,7 +351,7 @@ fn test_string_interpolated() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<String>(
|
engine.eval::<String>(
|
||||||
r"
|
"
|
||||||
const x = 42;
|
const x = 42;
|
||||||
`${x} worlds!`
|
`${x} worlds!`
|
||||||
"
|
"
|
||||||
@ -361,7 +361,7 @@ fn test_string_interpolated() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<String>(
|
engine.eval::<String>(
|
||||||
r"
|
"
|
||||||
const x = 42;
|
const x = 42;
|
||||||
`hello ${x}`
|
`hello ${x}`
|
||||||
"
|
"
|
||||||
@ -371,7 +371,7 @@ fn test_string_interpolated() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<String>(
|
engine.eval::<String>(
|
||||||
r"
|
"
|
||||||
const x = 20;
|
const x = 20;
|
||||||
`hello ${let y = x + 1; `${y * 2}`} worlds!`
|
`hello ${let y = x + 1; `${y * 2}`} worlds!`
|
||||||
"
|
"
|
||||||
|
@ -33,7 +33,7 @@ fn test_switch() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval_with_scope::<INT>(
|
engine.eval_with_scope::<INT>(
|
||||||
&mut scope,
|
&mut scope,
|
||||||
r"
|
"
|
||||||
let y = [1, 2, 3];
|
let y = [1, 2, 3];
|
||||||
|
|
||||||
switch y {
|
switch y {
|
||||||
@ -50,7 +50,7 @@ fn test_switch() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval_with_scope::<INT>(
|
engine.eval_with_scope::<INT>(
|
||||||
&mut scope,
|
&mut scope,
|
||||||
r"
|
"
|
||||||
let y = #{a:1, b:true, c:'x'};
|
let y = #{a:1, b:true, c:'x'};
|
||||||
|
|
||||||
switch y {
|
switch y {
|
||||||
@ -98,7 +98,7 @@ fn test_switch_condition() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval_with_scope::<INT>(
|
engine.eval_with_scope::<INT>(
|
||||||
&mut scope,
|
&mut scope,
|
||||||
r"
|
"
|
||||||
switch x / 2 {
|
switch x / 2 {
|
||||||
21 if x > 40 => 1,
|
21 if x > 40 => 1,
|
||||||
0 if x < 100 => 2,
|
0 if x < 100 => 2,
|
||||||
@ -113,7 +113,7 @@ fn test_switch_condition() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval_with_scope::<INT>(
|
engine.eval_with_scope::<INT>(
|
||||||
&mut scope,
|
&mut scope,
|
||||||
r"
|
"
|
||||||
switch x / 2 {
|
switch x / 2 {
|
||||||
21 if x < 40 => 1,
|
21 if x < 40 => 1,
|
||||||
0 if x < 100 => 2,
|
0 if x < 100 => 2,
|
||||||
@ -128,7 +128,7 @@ fn test_switch_condition() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
*engine
|
*engine
|
||||||
.compile(
|
.compile(
|
||||||
r"
|
"
|
||||||
switch x {
|
switch x {
|
||||||
21 if x < 40 => 1,
|
21 if x < 40 => 1,
|
||||||
21 if x == 10 => 10,
|
21 if x == 10 => 10,
|
||||||
|
@ -57,7 +57,7 @@ fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let x = 0;
|
let x = 0;
|
||||||
let foo = (exec |x| -> { x += 2 } while x < 42) * 10;
|
let foo = (exec |x| -> { x += 2 } while x < 42) * 10;
|
||||||
foo
|
foo
|
||||||
@ -67,7 +67,7 @@ fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let x = 0;
|
let x = 0;
|
||||||
exec |x| -> { x += 1 } while x < 42;
|
exec |x| -> { x += 1 } while x < 42;
|
||||||
x
|
x
|
||||||
@ -77,7 +77,7 @@ fn test_custom_syntax() -> Result<(), Box<EvalAltResult>> {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
exec |x| -> { x += 1 } while x < 42;
|
exec |x| -> { x += 1 } while x < 42;
|
||||||
x
|
x
|
||||||
"
|
"
|
||||||
|
@ -40,7 +40,7 @@ fn test_timestamp() -> Result<(), Box<EvalAltResult>> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
assert!(engine.eval::<bool>(
|
assert!(engine.eval::<bool>(
|
||||||
r"
|
"
|
||||||
let time1 = timestamp();
|
let time1 = timestamp();
|
||||||
for x in range(0, 10000) {}
|
for x in range(0, 10000) {}
|
||||||
let time2 = timestamp();
|
let time2 = timestamp();
|
||||||
|
@ -49,7 +49,7 @@ fn test_tokens_custom_operator_identifiers() -> Result<(), Box<EvalAltResult>> {
|
|||||||
#[cfg(not(feature = "no_function"))]
|
#[cfg(not(feature = "no_function"))]
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
fn foo(x, y) { y - x }
|
fn foo(x, y) { y - x }
|
||||||
1 + 2 * 3 foo 4 - 5 / 6
|
1 + 2 * 3 foo 4 - 5 / 6
|
||||||
"
|
"
|
||||||
@ -87,7 +87,7 @@ fn test_tokens_custom_operator_symbol() -> Result<(), Box<EvalAltResult>> {
|
|||||||
fn test_tokens_unicode_xid_ident() -> Result<(), Box<EvalAltResult>> {
|
fn test_tokens_unicode_xid_ident() -> Result<(), Box<EvalAltResult>> {
|
||||||
let engine = Engine::new();
|
let engine = Engine::new();
|
||||||
let result = engine.eval::<INT>(
|
let result = engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
fn すべての答え() { 42 }
|
fn すべての答え() { 42 }
|
||||||
すべての答え()
|
すべての答え()
|
||||||
",
|
",
|
||||||
@ -99,7 +99,7 @@ fn test_tokens_unicode_xid_ident() -> Result<(), Box<EvalAltResult>> {
|
|||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
|
|
||||||
let result = engine.eval::<INT>(
|
let result = engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
fn _1() { 1 }
|
fn _1() { 1 }
|
||||||
_1()
|
_1()
|
||||||
",
|
",
|
||||||
|
@ -6,7 +6,7 @@ fn test_while() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let x = 0;
|
let x = 0;
|
||||||
|
|
||||||
while x < 10 {
|
while x < 10 {
|
||||||
@ -31,7 +31,7 @@ fn test_do() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine.eval::<INT>(
|
engine.eval::<INT>(
|
||||||
r"
|
"
|
||||||
let x = 0;
|
let x = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
Loading…
Reference in New Issue
Block a user