Add a simple scope variable

This commit is contained in:
JT
2021-11-02 16:08:05 +13:00
parent 3c1b3473ae
commit d856cebebd
8 changed files with 204 additions and 47 deletions

View File

@@ -225,21 +225,6 @@ fn main() -> Result<()> {
Ok(Signal::Success(s)) => {
if s.trim() == "exit" {
break;
} else if s.trim() == "vars" {
engine_state.print_vars();
continue;
} else if s.trim() == "decls" {
engine_state.print_decls();
continue;
} else if s.trim() == "blocks" {
engine_state.print_blocks();
continue;
} else if s.trim() == "stack" {
stack.print_stack();
continue;
} else if s.trim() == "contents" {
engine_state.print_contents();
continue;
}
eval_source(

View File

@@ -801,3 +801,8 @@ fn long_flag() -> TestResult {
fn help_works_with_missing_requirements() -> TestResult {
run_test(r#"each --help | lines | length"#, "10")
}
#[test]
fn scope_variable() -> TestResult {
run_test(r"let x = 3; $scope.vars.0", "$x")
}