Disallow overriding keywords.
This commit is contained in:
@@ -19,6 +19,32 @@ fn test_var_scope() -> Result<(), Box<EvalAltResult>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_var_is_def() -> Result<(), Box<EvalAltResult>> {
|
||||
let engine = Engine::new();
|
||||
|
||||
assert!(engine.eval::<bool>(
|
||||
r#"
|
||||
let x = 42;
|
||||
is_def_var("x")
|
||||
"#
|
||||
)?);
|
||||
assert!(!engine.eval::<bool>(
|
||||
r#"
|
||||
let x = 42;
|
||||
is_def_var("y")
|
||||
"#
|
||||
)?);
|
||||
assert!(engine.eval::<bool>(
|
||||
r#"
|
||||
const x = 42;
|
||||
is_def_var("x")
|
||||
"#
|
||||
)?);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_scope_eval() -> Result<(), Box<EvalAltResult>> {
|
||||
let engine = Engine::new();
|
||||
|
Reference in New Issue
Block a user