about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-27 23:13:57 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-27 23:13:57 -0700
commitdd0846dc4efffbf1467af457d84c70f5a86a8583 (patch)
tree8fb293451ee091b25ad8968fc96285fe055086cf
parent83df835077a398103cbc67edc033dfe5d6dd401e (diff)
downloadmu-dd0846dc4efffbf1467af457d84c70f5a86a8583.tar.gz
1671 - better separate setup from code under test
Requires better support for special variable names in scenarios like
'screen' and 'console'.
-rw-r--r--050scenario.cc18
-rw-r--r--071print.mu2
-rw-r--r--072scenario_screen.cc8
-rw-r--r--075scenario_console.cc4
-rw-r--r--edit.mu149
5 files changed, 105 insertions, 76 deletions
diff --git a/050scenario.cc b/050scenario.cc
index 6ced90df..5ca64b48 100644
--- a/050scenario.cc
+++ b/050scenario.cc
@@ -138,10 +138,11 @@ void run_mu_scenario(const scenario& s) {
     Trace_stream = new trace_stream;
     setup();
   }
-//?   cerr << '^' << s.to_run << "$\n"; //? 4
   assert(Routines.empty());
-  run("recipe "+s.name+" [ " + s.to_run + " ]");
-//?   cerr << s.name << " done\n"; //? 1
+  vector<recipe_number> tmp = load("recipe "+s.name+" [ "+s.to_run+" ]");
+  bind_special_scenario_names(tmp.at(0));
+  transform_all();
+  run(tmp.front());
   if (not_already_inside_test && Trace_stream) {
     teardown();
     ofstream fout((Trace_dir+Trace_file).c_str());
@@ -180,14 +181,21 @@ case RUN: {
   tmp << "recipe run" << Next_recipe_number << " [ " << current_instruction().ingredients.at(0).name << " ]";
 //?   Show_rest_of_stream = true; //? 1
   vector<recipe_number> tmp_recipe = load(tmp.str());
-  // Predefined Scenario Locals In Run.
-  // End Predefined Scenario Locals In Run.
+  bind_special_scenario_names(tmp_recipe.at(0));
   transform_all();
 //?   cout << tmp_recipe.at(0) << ' ' << Recipe_number["main"] << '\n'; //? 1
   Current_routine->calls.push_front(call(tmp_recipe.at(0)));
   continue;  // not done with caller; don't increment current_step_index()
 }
 
+// Some variables for fake resources always get special addresses in
+// scenarios.
+:(code)
+void bind_special_scenario_names(recipe_number r) {
+  // Special Scenario Variable Names(r)
+  // End Special Scenario Variable Names(r)
+}
+
 :(scenario run_multiple)
 recipe main [
   run [
diff --git a/071print.mu b/071print.mu
index 0f9db476..c7ed5a2b 100644
--- a/071print.mu
+++ b/071print.mu
@@ -21,6 +21,8 @@ recipe new-fake-screen [
   width:address:number/deref <- next-ingredient
   height:address:number <- get-address result:address:screen/deref, num-rows:offset
   height:address:number/deref <- next-ingredient
+#?   $print height:address:number/deref, [ 
+#? ] #? 1
   row:address:number <- get-address result:address:screen/deref, cursor-row:offset
   row:address:number/deref <- copy 0:literal
   column:address:number <- get-address result:address:screen/deref, cursor-column:offset
diff --git a/072scenario_screen.cc b/072scenario_screen.cc
index f388ea11..25298629 100644
--- a/072scenario_screen.cc
+++ b/072scenario_screen.cc
@@ -135,8 +135,8 @@ assert(Name[tmp_recipe.at(0)][""] < Max_variables_in_scenarios);
 // Scenario Globals.
 const long long int SCREEN = Next_predefined_global_for_scenarios++;
 // End Scenario Globals.
-:(before "End Predefined Scenario Locals In Run")
-Name[tmp_recipe.at(0)]["screen"] = SCREEN;
+:(before "End Special Scenario Variable Names(r)")
+Name[r]["screen"] = SCREEN;
 
 :(before "End Rewrite Instruction(curr)")
 // rewrite `assume-screen width, height` to
@@ -207,7 +207,9 @@ void check_screen(const string& expected_contents, const int color) {
   raw_string_stream cursor(expected_contents);
   // todo: too-long expected_contents should fail
   long long int addr = screen_data_start+1;  // skip length
+//?   cerr << "screen height " << screen_height << '\n'; //? 1
   for (long long int row = 0; row < screen_height; ++row) {
+//?     cerr << "row: " << row << '\n'; //? 1
     cursor.skip_whitespace_and_comments();
     if (cursor.at_end()) break;
     assert(cursor.get() == '.');
@@ -275,6 +277,8 @@ void check_screen(const string& expected_contents, const int color) {
 raw_string_stream::raw_string_stream(const string& backing) :index(0), max(backing.size()), buf(backing.c_str()) {}
 
 bool raw_string_stream::at_end() const {
+//?   cerr << index << ' ' << max << '\n'; //? 1
+//?   cerr << buf << "$\n"; //? 1
   if (index >= max) return true;
   if (tb_utf8_char_length(buf[index]) > max-index) {
     raise << "unicode string seems corrupted at index "<< index << " character " << static_cast<int>(buf[index]) << '\n';
diff --git a/075scenario_console.cc b/075scenario_console.cc
index 017eebcd..427906e9 100644
--- a/075scenario_console.cc
+++ b/075scenario_console.cc
@@ -31,8 +31,8 @@ scenario keyboard-in-scenario [
 
 :(before "End Scenario Globals")
 const long long int CONSOLE = Next_predefined_global_for_scenarios++;
-:(before "End Predefined Scenario Locals In Run")
-Name[tmp_recipe.at(0)]["console"] = CONSOLE;
+:(before "End Special Scenario Variable Names(r)")
+Name[r]["console"] = CONSOLE;
 
 //: allow naming just for 'console'
 :(before "End is_special_name Cases")
diff --git a/edit.mu b/edit.mu
index ded8ad48..6046f454 100644
--- a/edit.mu
+++ b/edit.mu
@@ -19,8 +19,8 @@ jkl]
 scenario editor-initially-prints-string-to-screen [
   assume-screen 10:literal/width, 5:literal/height
   run [
-    s:address:array:character <- new [abc]
-    new-editor s:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
+    1:address:array:character <- new [abc]
+    new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   ]
   screen-should-contain [
     .abc       .
@@ -538,12 +538,21 @@ recipe previous-line-length [
 
 scenario editor-handles-empty-event-queue [
   assume-screen 10:literal/width, 5:literal/height
+#?   3:number <- get screen:address/deref, num-rows:offset #? 1
+#?   $print [0: ], screen:address, [: ], 3:number, [ 
+#? ] #? 1
+  1:address:array:character <- new [abc]
+#?   $print [1: ], screen:address, [ 
+#? ] #? 1
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console []
+#?   $print [8: ], screen:address, [ 
+#? ] #? 1
   run [
-    s:address:array:character <- new [abc]
-    editor:address:editor-data <- new-editor s:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
-    event-loop screen:address, console:address, editor:address:editor-data
+    event-loop screen:address, console:address, 2:address:editor-data
   ]
+#?   $print [9: ], screen:address, [ 
+#? ] #? 1
   screen-should-contain [
     .abc       .
     .          .
@@ -552,12 +561,12 @@ scenario editor-handles-empty-event-queue [
 
 scenario editor-handles-mouse-clicks [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
-    left-click 0, 1
+    left-click 0, 1  # on the 'b'
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
     3:number <- get 2:address:editor-data/deref, cursor-row:offset
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
@@ -574,12 +583,12 @@ scenario editor-handles-mouse-clicks [
 
 scenario editor-handles-mouse-clicks-outside-text [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 0, 7  # last line, to the right of text
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
     3:number <- get 2:address:editor-data/deref, cursor-row:offset
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
@@ -592,13 +601,13 @@ scenario editor-handles-mouse-clicks-outside-text [
 
 scenario editor-handles-mouse-clicks-outside-text-2 [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc
+def]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 0, 7  # interior line, to the right of text
   ]
   run [
-    1:address:array:character <- new [abc
-def]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
     3:number <- get 2:address:editor-data/deref, cursor-row:offset
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
@@ -611,13 +620,13 @@ def]
 
 scenario editor-handles-mouse-clicks-outside-text-3 [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc
+def]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 2, 7  # below text
   ]
   run [
-    1:address:array:character <- new [abc
-def]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
     3:number <- get 2:address:editor-data/deref, cursor-row:offset
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
@@ -630,14 +639,14 @@ def]
 
 scenario editor-handles-mouse-clicks-outside-column [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  # editor occupies only left half of screen
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
   assume-console [
     # click on right half of screen
     left-click 3, 8
   ]
   run [
-    1:address:array:character <- new [abc]
-    # editor occupies only left half of screen
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
     3:number <- get 2:address:editor-data/deref, cursor-row:offset
     4:number <- get 2:address:editor-data/deref, cursor-column:offset
@@ -654,12 +663,12 @@ scenario editor-handles-mouse-clicks-outside-column [
 
 scenario editor-inserts-characters-into-empty-editor [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new []
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
   assume-console [
     type [abc]
   ]
   run [
-    1:address:array:character <- new []
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -670,14 +679,14 @@ scenario editor-inserts-characters-into-empty-editor [
 
 scenario editor-inserts-characters-at-cursor [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     type [0]
     left-click 0, 2
     type [d]
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -688,13 +697,13 @@ scenario editor-inserts-characters-at-cursor [
 
 scenario editor-inserts-characters-at-cursor-2 [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 0, 5  # right of last line
     type [d]  # should append
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -705,13 +714,13 @@ scenario editor-inserts-characters-at-cursor-2 [
 
 scenario editor-inserts-characters-at-cursor-3 [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 3, 5  # below all text
     type [d]  # should append
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -722,14 +731,14 @@ scenario editor-inserts-characters-at-cursor-3 [
 
 scenario editor-inserts-characters-at-cursor-4 [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc
+d]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 3, 5  # below all text
     type [e]  # should append
   ]
   run [
-    1:address:array:character <- new [abc
-d]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -741,14 +750,14 @@ d]
 
 scenario editor-inserts-characters-at-cursor-5 [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc
+d]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 3, 5  # below all text
     type [ef]  # should append multiple characters in order
   ]
   run [
-    1:address:array:character <- new [abc
-d]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -760,27 +769,29 @@ d]
 
 scenario editor-wraps-line-on-insert [
   assume-screen 5:literal/width, 3:literal/height
+  1:address:array:character <- new [abcd]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
+  # type a letter
   assume-console [
     type [e]
   ]
   run [
-    1:address:array:character <- new [abcd]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
+  # no wrap yet
   screen-should-contain [
-    # no wrap yet
     .eabcd.
     .     .
   ]
+  # type a second letter
   assume-console [
     type [f]
   ]
   run [
     event-loop screen:address, console:address, 2:address:editor-data
   ]
+  # now wrap
   screen-should-contain [
-    # now wrap
     .efab↩.
     .cd   .
     .     .
@@ -789,12 +800,12 @@ scenario editor-wraps-line-on-insert [
 
 scenario editor-moves-cursor-after-inserting-characters [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
   assume-console [
     type [01]
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 5:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -805,13 +816,13 @@ scenario editor-moves-cursor-after-inserting-characters [
 
 scenario editor-moves-cursor-down-after-inserting-newline [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     type [0
 1]
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -823,13 +834,13 @@ scenario editor-moves-cursor-down-after-inserting-newline [
 
 scenario editor-moves-cursor-right-with-key [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     press 65514  # right arrow
     type [0]
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -840,6 +851,9 @@ scenario editor-moves-cursor-right-with-key [
 
 scenario editor-moves-cursor-to-next-line-with-right-arrow [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc
+d]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     press 65514  # right arrow
     press 65514  # right arrow
@@ -848,9 +862,6 @@ scenario editor-moves-cursor-to-next-line-with-right-arrow [
     type [0]
   ]
   run [
-    1:address:array:character <- new [abc
-d]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -862,15 +873,15 @@ d]
 
 scenario editor-moves-cursor-to-next-line-with-right-arrow-at-end-of-line [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc
+d]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 0, 3
     press 65514  # right arrow - next line
     type [0]
   ]
   run [
-    1:address:array:character <- new [abc
-d]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -882,14 +893,14 @@ d]
 
 scenario editor-moves-cursor-left-with-key [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   assume-console [
     left-click 0, 2
     press 65515  # left arrow
     type [0]
   ]
   run [
-    1:address:array:character <- new [abc]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -900,6 +911,10 @@ scenario editor-moves-cursor-left-with-key [
 
 scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line [
   assume-screen 10:literal/width, 5:literal/height
+  # initialize editor with two lines
+  1:address:array:character <- new [abc
+d]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   # position cursor at start of second line (so there's no previous newline)
   assume-console [
     left-click 1, 0
@@ -907,9 +922,6 @@ scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line [
     type [0]
   ]
   run [
-    1:address:array:character <- new [abc
-d]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -921,17 +933,19 @@ d]
 
 scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-2 [
   assume-screen 10:literal/width, 5:literal/height
-  # position cursor further down (so there's a previous newline)
+  # initialize editor with three lines
+  1:address:array:character <- new [abc
+def
+g]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
+  # position cursor further down (so there's a newline before the character at
+  # the cursor)
   assume-console [
     left-click 2, 0
     press 65515  # left arrow
     type [0]
   ]
   run [
-    1:address:array:character <- new [abc
-def
-g]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -944,6 +958,10 @@ g]
 
 scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-3 [
   assume-screen 10:literal/width, 5:literal/height
+  1:address:array:character <- new [abc
+def
+g]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   # position cursor at start of text
   assume-console [
     left-click 0, 0
@@ -951,10 +969,6 @@ scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-3
     type [0]
   ]
   run [
-    1:address:array:character <- new [abc
-def
-g]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [
@@ -967,6 +981,11 @@ g]
 
 scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-4 [
   assume-screen 10:literal/width, 5:literal/height
+  # initialize editor with text containing an empty line
+  1:address:array:character <- new [abc
+
+d]
+  2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
   # position cursor right after empty line
   assume-console [
     left-click 2, 0
@@ -974,10 +993,6 @@ scenario editor-moves-cursor-to-previous-line-with-left-arrow-at-start-of-line-4
     type [0]
   ]
   run [
-    1:address:array:character <- new [abc
-
-d]
-    2:address:editor-data <- new-editor 1:address:array:character, screen:address, 0:literal/top, 0:literal/left, 10:literal/right
     event-loop screen:address, console:address, 2:address:editor-data
   ]
   screen-should-contain [