Feat: script execution performance optimization
This commit is contained in:
@@ -29,7 +29,7 @@ fn word_with_param() {
|
||||
|
||||
#[test]
|
||||
fn word_available_across_evaluations() {
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let ctx = default_ctx();
|
||||
f.evaluate(": hi 42 ;", &ctx).unwrap();
|
||||
f.evaluate("hi", &ctx).unwrap();
|
||||
@@ -38,7 +38,7 @@ fn word_available_across_evaluations() {
|
||||
|
||||
#[test]
|
||||
fn word_defined_in_one_forth_available_in_same() {
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let ctx = default_ctx();
|
||||
f.evaluate(": ten 10 ;", &ctx).unwrap();
|
||||
f.clear_stack();
|
||||
@@ -104,7 +104,7 @@ fn define_word_with_sound() {
|
||||
|
||||
#[test]
|
||||
fn define_word_with_conditional() {
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let ctx = default_ctx();
|
||||
f.evaluate(": maybe-double dup 5 gt if 2 * then ;", &ctx).unwrap();
|
||||
f.clear_stack();
|
||||
@@ -117,7 +117,7 @@ fn define_word_with_conditional() {
|
||||
|
||||
#[test]
|
||||
fn forget_removes_word() {
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let ctx = default_ctx();
|
||||
f.evaluate(": double 2 * ;", &ctx).unwrap();
|
||||
f.evaluate("5 double", &ctx).unwrap();
|
||||
@@ -135,7 +135,7 @@ fn forget_removes_word() {
|
||||
|
||||
#[test]
|
||||
fn forget_nonexistent_is_noop() {
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let ctx = default_ctx();
|
||||
f.evaluate("\"nosuchword\" forget", &ctx).unwrap();
|
||||
f.evaluate("42", &ctx).unwrap();
|
||||
@@ -144,7 +144,7 @@ fn forget_nonexistent_is_noop() {
|
||||
|
||||
#[test]
|
||||
fn forget_and_redefine() {
|
||||
let f = forth();
|
||||
let mut f = forth();
|
||||
let ctx = default_ctx();
|
||||
f.evaluate(": foo 10 ;", &ctx).unwrap();
|
||||
f.evaluate("foo", &ctx).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user