rhai/tests/comments.rs

26 lines
489 B
Rust
Raw Normal View History

2020-11-14 23:43:36 +08:00
use rhai::{Engine, EvalAltResult, INT};
2017-11-03 09:58:51 -07:00
#[test]
2020-11-14 23:43:36 +08:00
fn test_comments() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
2017-11-03 09:58:51 -07:00
2020-11-14 23:43:36 +08:00
assert_eq!(
engine.eval::<INT>("let x = 42; x // I am a single line comment, yay!")?,
42
);
2017-11-03 09:58:51 -07:00
2020-11-14 23:43:36 +08:00
assert_eq!(
engine.eval::<INT>(
r#"
let /* I am a
multi-line
comment, yay!
*/ x = 42; x
"#
)?,
42
);
Ok(())
2017-11-03 09:58:51 -07:00
}