about summary refs log blame commit diff stats
path: root/html/edit/010-warnings.mu.html
blob: ca9008b77fcb48d81b5b36923473424004a30f56 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428











































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - edit/010-warnings.mu</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v1">
<meta name="syntax" content="none">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="minimal">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; }
body { font-family: monospace; color: #eeeeee; background-color: #080808; }
* { font-size: 1.05em; }
.muRecipe { color: #ff8700; }
.muData { color: #ffff00; }
.Special { color: #ff6060; }
.muScenario { color: #00af00; }
.Comment { color: #9090ff; }
.Constant { color: #00a0a0; }
.SalientComment { color: #00ffff; }
.Delimiter { color: #a04060; }
.muControl { color: #c0a020; }
-->
</style>

<script type='text/javascript'>
<!--

-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="SalientComment">## handling malformed programs</span>

<span class="muData">container</span> programming-environment-data [
  recipe-warnings:address:array:character
]

<span class="Comment"># copy code from recipe editor, persist, load into mu, save any warnings</span>
<span class="muRecipe">recipe!</span> update-recipes [
  <span class="Constant">local-scope</span>
  env:address:programming-environment-data<span class="Special"> &lt;- </span><span class="Constant">next-ingredient</span>
  screen:address<span class="Special"> &lt;- </span><span class="Constant">next-ingredient</span>
  recipes:address:editor-data<span class="Special"> &lt;- </span>get *env, <span class="Constant">recipes:offset</span>
  in:address:array:character<span class="Special"> &lt;- </span>editor-contents recipes
  save <span class="Constant">[recipes.mu]</span>, in
  recipe-warnings:address:address:array:character<span class="Special"> &lt;- </span>get-address *env, <span class="Constant">recipe-warnings:offset</span>
  *recipe-warnings<span class="Special"> &lt;- </span>reload in
  <span class="Comment"># if recipe editor has errors, stop</span>
  <span class="Delimiter">{</span>
    <span class="muControl">break-unless</span> *recipe-warnings
    status:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[errors found]</span>
    update-status screen, status, <span class="Constant">1/red</span>
    <span class="muControl">reply</span> <span class="Constant">1/errors-found</span>, env/same-as-ingredient:<span class="Constant">0</span>, screen/same-as-ingredient:<span class="Constant">1</span>
  <span class="Delimiter">}</span>
  <span class="muControl">reply</span> <span class="Constant">0/no-errors-found</span>, env/same-as-ingredient:<span class="Constant">0</span>, screen/same-as-ingredient:<span class="Constant">1</span>
]

<span class="muRecipe">before</span> <span class="Constant">&lt;render-components-end&gt;</span> [
  trace <span class="Constant">11</span>, <span class="Constant">[app]</span>, <span class="Constant">[render status]</span>
  recipe-warnings:address:array:character<span class="Special"> &lt;- </span>get *env, <span class="Constant">recipe-warnings:offset</span>
  <span class="Delimiter">{</span>
    <span class="muControl">break-unless</span> recipe-warnings
    status:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[errors found]</span>
    update-status screen, status, <span class="Constant">1/red</span>
  <span class="Delimiter">}</span>
]

<span class="muRecipe">before</span> <span class="Constant">&lt;render-recipe-components-end&gt;</span> [
  <span class="Delimiter">{</span>
    recipe-warnings:address:array:character<span class="Special"> &lt;- </span>get *env, <span class="Constant">recipe-warnings:offset</span>
    <span class="muControl">break-unless</span> recipe-warnings
    row, screen<span class="Special"> &lt;- </span>render-string screen, recipe-warnings, left, right, <span class="Constant">1/red</span>, row
  <span class="Delimiter">}</span>
]

<span class="muData">container</span> sandbox-data [
  warnings:address:array:character
]

<span class="muRecipe">recipe!</span> update-sandbox [
  <span class="Constant">local-scope</span>
  sandbox:address:sandbox-data<span class="Special"> &lt;- </span><span class="Constant">next-ingredient</span>
  data:address:array:character<span class="Special"> &lt;- </span>get *sandbox, <span class="Constant">data:offset</span>
  response:address:address:array:character<span class="Special"> &lt;- </span>get-address *sandbox, <span class="Constant">response:offset</span>
  warnings:address:address:array:character<span class="Special"> &lt;- </span>get-address *sandbox, <span class="Constant">warnings:offset</span>
  trace:address:address:array:character<span class="Special"> &lt;- </span>get-address *sandbox, <span class="Constant">trace:offset</span>
  fake-screen:address:address:screen<span class="Special"> &lt;- </span>get-address *sandbox, <span class="Constant">screen:offset</span>
  *response, *warnings, *fake-screen, *trace, completed?:boolean<span class="Special"> &lt;- </span>run-interactive data
  <span class="Delimiter">{</span>
    <span class="muControl">break-if</span> *warnings
    <span class="muControl">break-if</span> completed?:boolean
    *warnings<span class="Special"> &lt;- </span>new <span class="Constant">[took too long!</span>
<span class="Constant">]</span>
  <span class="Delimiter">}</span>
]

<span class="muRecipe">after</span> <span class="Constant">&lt;render-sandbox-results&gt;</span> [
  <span class="Delimiter">{</span>
    sandbox-warnings:address:array:character<span class="Special"> &lt;- </span>get *sandbox, <span class="Constant">warnings:offset</span>
    <span class="muControl">break-unless</span> sandbox-warnings
    *response-starting-row<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>  <span class="Comment"># no response</span>
    row, screen<span class="Special"> &lt;- </span>render-string screen, sandbox-warnings, left, right, <span class="Constant">1/red</span>, row
    <span class="muControl">jump</span> <span class="Constant">+render-sandbox-end:label</span>
  <span class="Delimiter">}</span>
]

<span class="muScenario">scenario</span> run-shows-warnings-in-get [
  $close-trace  <span class="Comment"># trace too long</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[ </span>
<span class="Constant">recipe foo [</span>
<span class="Constant">  get 123:number, foo:offset</span>
<span class="Constant">]</span>]
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[foo]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  screen-should-contain [
   <span class="Constant"> .  errors found                                                                   run (F4)           .</span>
   <span class="Constant"> .                                                  ┊foo                                              .</span>
   <span class="Constant"> .recipe foo [                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .  get 123:number, foo:offset                      ┊                                                 .</span>
   <span class="Constant"> .]                                                 ┊                                                 .</span>
   <span class="Constant"> .unknown element foo in container number           ┊                                                 .</span>
   <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                                                 .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
  screen-should-contain-in-color <span class="Constant">1/red</span>, [
   <span class="Constant"> .  errors found                                                                                      .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .unknown element foo in container number                                                             .</span>
   <span class="Constant"> .                                                                                                    .</span>
  ]
]

<span class="muScenario">scenario</span> run-shows-missing-type-warnings [
  $close-trace  <span class="Comment"># trace too long</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[ </span>
<span class="Constant">recipe foo [</span>
<span class="Constant">  x &lt;- copy 0</span>
<span class="Constant">]</span>]
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[foo]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  screen-should-contain [
   <span class="Constant"> .  errors found                                                                   run (F4)           .</span>
   <span class="Constant"> .                                                  ┊foo                                              .</span>
   <span class="Constant"> .recipe foo [                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .  x &lt;- copy 0                                     ┊                                                 .</span>
   <span class="Constant"> .]                                                 ┊                                                 .</span>
   <span class="Constant"> .missing type in 'x &lt;- copy 0'                     ┊                                                 .</span>
   <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                                                 .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
]

<span class="muScenario">scenario</span> run-shows-unbalanced-bracket-warnings [
  $close-trace  <span class="Comment"># trace too long</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span>
  <span class="Comment"># recipe is incomplete (unbalanced '[')</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[ </span>
<span class="Constant">recipe foo «</span>
<span class="Constant">  x &lt;- copy 0</span>
<span class="Constant">]</span>
  string-replace <span class="Constant">1</span>:address:array:character, <span class="Constant">171/«</span>, <span class="Constant">91</span>  <span class="Comment"># '['</span>
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[foo]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  screen-should-contain [
   <span class="Constant"> .  errors found                                                                   run (F4)           .</span>
   <span class="Constant"> .                                                  ┊foo                                              .</span>
   <span class="Constant"> .recipe foo \\\[                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .  x &lt;- copy 0                                     ┊                                                 .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
   <span class="Constant"> .9: unbalanced '\\\[' for recipe                      ┊                                                 .</span>
   <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                                                 .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
]

<span class="muScenario">scenario</span> run-shows-get-on-non-container-warnings [
  $close-trace  <span class="Comment"># trace too long</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[ </span>
<span class="Constant">recipe foo [</span>
<span class="Constant">  x:address:point &lt;- new point:type</span>
<span class="Constant">  get x:address:point, 1:offset</span>
<span class="Constant">]</span>]
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[foo]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  screen-should-contain [
   <span class="Constant"> .                                                                                 run (F4)           .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
   <span class="Constant"> .recipe foo [                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .  x:address:point &lt;- new point:type               ┊                                                x.</span>
   <span class="Constant"> .  get x:address:point, 1:offset                   ┊foo                                              .</span>
   <span class="Constant"> .]                                                 ┊foo: first ingredient of 'get' should be a conta↩.</span>
   <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊iner, but got x:address:point                    .</span>
   <span class="Constant"> .                                                  ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
]

<span class="muScenario">scenario</span> run-shows-non-literal-get-argument-warnings [
  $close-trace  <span class="Comment"># trace too long</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[ </span>
<span class="Constant">recipe foo [</span>
<span class="Constant">  x:number &lt;- copy 0</span>
<span class="Constant">  y:address:point &lt;- new point:type</span>
<span class="Constant">  get *y:address:point, x:number</span>
<span class="Constant">]</span>]
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[foo]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  screen-should-contain [
   <span class="Constant"> .  errors found                                                                   run (F4)           .</span>
   <span class="Constant"> .                                                  ┊foo                                              .</span>
   <span class="Constant"> .recipe foo [                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .  x:number &lt;- copy 0                              ┊                                                 .</span>
   <span class="Constant"> .  y:address:point &lt;- new point:type               ┊                                                 .</span>
   <span class="Constant"> .  get *y:address:point, x:number                  ┊                                                 .</span>
   <span class="Constant"> .]                                                 ┊                                                 .</span>
   <span class="Constant"> .foo: expected ingredient 1 of 'get' to have type ↩┊                                                 .</span>
   <span class="Constant"> .'offset'; got x:number                            ┊                                                 .</span>
   <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                                                 .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
]

<span class="muScenario">scenario</span> run-shows-warnings-everytime [
  $close-trace  <span class="Comment"># trace too long</span>
  <span class="Comment"># try to run a file with an error</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">15/height</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[ </span>
<span class="Constant">recipe foo [</span>
<span class="Constant">  x:number &lt;- copy y:number</span>
<span class="Constant">]</span>]
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[foo]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  screen-should-contain [
   <span class="Constant"> .  errors found                                                                   run (F4)           .</span>
   <span class="Constant"> .                                                  ┊foo                                              .</span>
   <span class="Constant"> .recipe foo [                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .  x:number &lt;- copy y:number                       ┊                                                 .</span>
   <span class="Constant"> .]                                                 ┊                                                 .</span>
   <span class="Constant"> .use before set: y in foo                          ┊                                                 .</span>
   <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                                                 .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
  <span class="Comment"># rerun the file, check for the same error</span>
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  screen-should-contain [
   <span class="Constant"> .  errors found                                                                   run (F4)           .</span>
   <span class="Constant"> .                                                  ┊foo                                              .</span>
   <span class="Constant"> .recipe foo [                                      ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .  x:number &lt;- copy y:number                       ┊                                                 .</span>
   <span class="Constant"> .]                                                 ┊                                                 .</span>
   <span class="Constant"> .use before set: y in foo                          ┊                                                 .</span>
   <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊                                                 .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
]

<span class="muScenario">scenario</span> run-instruction-and-print-warnings [
  $close-trace  <span class="Comment"># trace too long</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span>
  <span class="Comment"># left editor is empty</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[]</span>
  <span class="Comment"># right editor contains an illegal instruction</span>
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[get 1234:number, foo:offset]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  <span class="Comment"># run the code in the editors</span>
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  <span class="Comment"># check that screen prints error message in red</span>
  screen-should-contain [
   <span class="Constant"> .                                                                                 run (F4)           .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
<span class="Constant">    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .                                                  ┊                                                x.</span>
   <span class="Constant"> .                                                  ┊get 1234:number, foo:offset                      .</span>
   <span class="Constant"> .                                                  ┊unknown element foo in container number          .</span>
   <span class="Constant"> .                                                  ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
  screen-should-contain-in-color <span class="Constant">7/white</span>, [
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                   get 1234:number, foo:offset                      .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
  ]
  screen-should-contain-in-color <span class="Constant">1/red</span>, [
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                   unknown element foo in container number          .</span>
   <span class="Constant"> .                                                                                                    .</span>
  ]
  screen-should-contain-in-color <span class="Constant">245/grey</span>, [
   <span class="Constant"> .                                                                                                    .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
<span class="Constant">    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .                                                  ┊                                                x.</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
   <span class="Constant"> .                                                  ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
]

<span class="muScenario">scenario</span> run-instruction-and-print-warnings-only-once [
  $close-trace  <span class="Comment"># trace too long</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">10/height</span>
  <span class="Comment"># left editor is empty</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[]</span>
  <span class="Comment"># right editor contains an illegal instruction</span>
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[get 1234:number, foo:offset]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  <span class="Comment"># run the code in the editors multiple times</span>
  assume-console [
    press F4
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  <span class="Comment"># check that screen prints error message just once</span>
  screen-should-contain [
   <span class="Constant"> .                                                                                 run (F4)           .</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
<span class="Constant">    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .                                                  ┊                                                x.</span>
   <span class="Constant"> .                                                  ┊get 1234:number, foo:offset                      .</span>
   <span class="Constant"> .                                                  ┊unknown element foo in container number          .</span>
   <span class="Constant"> .                                                  ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
]

<span class="muScenario">scenario</span> sandbox-can-handle-infinite-loop [
  $close-trace  <span class="Comment"># trace too long</span>
  assume-screen <span class="Constant">100/width</span>, <span class="Constant">20/height</span>
  <span class="Comment"># left editor is empty</span>
  <span class="Constant">1</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[recipe foo [</span>
<span class="Constant">  {</span>
<span class="Constant">    loop</span>
<span class="Constant">  }</span>
<span class="Constant">]</span>]
  <span class="Comment"># right editor contains an instruction</span>
  <span class="Constant">2</span>:address:array:character<span class="Special"> &lt;- </span>new <span class="Constant">[foo]</span>
  <span class="Constant">3</span>:address:programming-environment-data<span class="Special"> &lt;- </span>new-programming-environment screen:address, <span class="Constant">1</span>:address:array:character, <span class="Constant">2</span>:address:array:character
  <span class="Comment"># run the sandbox</span>
  assume-console [
    press F4
  ]
  run [
    event-loop screen:address, console:address, <span class="Constant">3</span>:address:programming-environment-data
  ]
  screen-should-contain [
   <span class="Constant"> .                                                                                 run (F4)           .</span>
   <span class="Constant"> .recipe foo [                                      ┊                                                 .</span>
   <span class="Constant"> .  {                                               ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .    loop                                          ┊                                                x.</span>
   <span class="Constant"> .  }                                               ┊foo                                              .</span>
   <span class="Constant"> .]                                                 ┊took too long!                                   .</span>
<span class="Constant">    .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━.</span>
   <span class="Constant"> .                                                  ┊                                                 .</span>
  ]
]
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->