Expr::Switch -> Stmt::Switch.

This commit is contained in:
Stephen Chung
2020-11-14 23:43:36 +08:00
parent 0182117759
commit a63f14b59c
6 changed files with 119 additions and 87 deletions

View File

@@ -1,14 +1,25 @@
use rhai::{Engine, INT};
use rhai::{Engine, EvalAltResult, INT};
#[test]
fn test_comments() {
fn test_comments() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert!(engine
.eval::<INT>("let x = 5; x // I am a single line comment, yay!")
.is_ok());
assert_eq!(
engine.eval::<INT>("let x = 42; x // I am a single line comment, yay!")?,
42
);
assert!(engine
.eval::<INT>("let /* I am a multi-line comment, yay! */ x = 5; x")
.is_ok());
assert_eq!(
engine.eval::<INT>(
r#"
let /* I am a
multi-line
comment, yay!
*/ x = 42; x
"#
)?,
42
);
Ok(())
}

View File

@@ -1,4 +1,4 @@
use rhai::{Dynamic, Engine, EvalAltResult, Scope, INT};
use rhai::{Engine, EvalAltResult, Scope, INT};
#[test]
fn test_switch() -> Result<(), Box<EvalAltResult>> {