Closed youngzhaozju closed 2 years ago
Hey,
I found that I cannot print ${x} message from rhai correctly. I designed many cases using the following case.
mod tests { use rhai::{Engine, EvalAltResult};
#[test] fn test() {} #[test] fn texst() { let mut engine = Engine::new(); let result = engine.eval::<i64>( **r#" let a = 12.3; print("test1"); 1"#,** ); }
}
Case 1: r#" let a = 12.3; print("test1"); 1"#, result: running 1 test test1
Case 2: r#" let a = 12.3; print("test1 ${a}"); 1"#,
result: running 1 test test1 ${a}
Case 3: r#" let a = 12.3; print('test1 ${a}'); 1"#, result: Nothing
Case 4: let a = 12.3; print("test1"); print("test1 ${a}"); 1"#, result: running 1 test test1 test1 ${a}
Use back-ticks for string interpolation.
https://rhai.rs/book/language/strings-chars.html#string-interpolation
Thank you!
Hey,
I found that I cannot print ${x} message from rhai correctly. I designed many cases using the following case.
[cfg(test)]
mod tests { use rhai::{Engine, EvalAltResult};
}
Case 1: r#" let a = 12.3; print("test1"); 1"#, result: running 1 test test1
Case 2: r#" let a = 12.3; print("test1 ${a}"); 1"#,
result: running 1 test test1 ${a}
Case 3: r#" let a = 12.3; print('test1 ${a}'); 1"#, result: Nothing
Case 4: let a = 12.3; print("test1"); print("test1 ${a}"); 1"#, result: running 1 test test1 test1 ${a}