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 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
|
\: This file checks whether various kinds of errors escalate correctly.
\: It also checks for every primitive whether errors are pushed correctly
\: so that catch can catch them. If a primitive has different error
\: paths, all of them should be represented here.
\: Process this file with
\: zoem -i stress --system-honor --unsafe-silent --err-out -o - > stress.ozm .
\: With valgrind, it should be memory and error clean.
\: One should try to find cases where primitives (should) accept some kind
\: of sublanguage, and test them with misfits.
\: \begin{label}{{!}{a}} is/was a good example.
\if{\defined{key}{get_it_on}}{}{
\write{-}{device}{Process this file with
../src/zoem -i stress --system-honor --unsafe-silent --err-out -s get_it_on=1 -o - > stress.ozm\@{\N}
}
\done
}
\set{defs}{\!{
\set{recurse_segment}{\recurse_segment}
\set{recurse_stack}{\eval{\recurse_stack}}
\set{overflow_user}{\push{user}\overflow_user}
\set{underflow_user}{\pop{user}\underflow_user}
\set{foo}{foo_start\@{ foo_at }foo_end}
\set{__device__}{stress}
\set{one}{1}
\set{zero}{0}
\set{abc}{abc}
\set{def}{def}
\set{ct}{0}
\env{myenv}{myenv_start}{myenv_end}
\env{myenv2}{myenv2_start}{myenv2_end}
\begin{myenv}
\begin{myenv2}
}}
\write{\__fnout__}{device}{DEFINITIONS USED:\apply{protect#1}{{\defs}}}
\eval{\defs}
\@{\P}
\apply{_#2{
\!write{-}{device}{||| \1:\@{\N}}
\!write{-}{device}{||| \!protect{\2}\@{\N}}
\!catch{error}{\!abc[\2]\!def}\@{\P}
\!setx{ct}{\!let{\!ct+1}}
}}{
\!{
{undef in plain scope}
{\nsk}
{undef in at scope}
{\@{\nsk}}
{undef at deeper level}
{\eval{\textmap{{word}{ucase}{number}{roman}}{\nsk}}}
{undef in and scope} \: error at output time
{\write{\__fnout__}{device}{\@{\&{\nsk}}}}
{recurse segment}
{\recurse_segment}
{recurse stack}
{\recurse_stack}
{overflow user dictionary stack}
{\overflow_user}
{underflow user dictionary stack (requires nuser>nsegment)}
{\underflow_user}
{inserting spurious left curly}
{\eval{\!""\__lc__}}
{and scope in plain scope}
{\&{\foo}}
{at scope in and scope}
{\@{\&{\foo}}}
{incorrect anonymous key}
{\_#1{\1}{bar}{foo}}
{and scope in plain scope}
{\&{\foo}}
{incorrect anonymous key}
{\_#1{\1}{bar}{foo}}
\: xml sugar
\: syntactig sugar happens at output time, not digest time.
\: catch cannot catch this, write can.
{some broken XML syntactic sugar}
{\write{\__fnout__}{device}{\<foo>\<bar>\</bar>\</zut>}}
{\@{\C}XML syntactic sugar underflow}
{\write{\__fnout__}{device}{\<foo>\<bar>\<>\<>\<>}}
{XML content syntax error}
{\<foo>{\nsk}}
\: \$#2
{error in $#2}
{\${stress}{\nsk}}
\: \%#1
\: grape keys
\: !absence is not (yet) an error
{absent grape node, fetched}
{\%{nsg}}
{absent grape node, freed}
{\%free{nsg}}
{absent grape node, dumped}
{\%dump{nsg}}
\: \apply#2
{no such key}
{\apply{nsk#2}{{a}{b}}}
{wrong anonymous key}
{\apply{_#a{\1}}{{a}{b}}}
{trailing arguments}
{\apply{_#2{[\1\2]}}{{a}}}
{argument does not parse}
{\apply{_#2{[\1\2]}}{{a}{b}{c}{\nsk}}}
\: \begin#2
{label does not exist}
{\begin{nsl}}
{argument does not parse}
{\begin{myenv}{{\nsk}{\nsk}}}
\: \branch#1
{parse error}
{\branch{{\let{0<}}{}}}
\: \catch#2
{uncaught catch}
{\catch{towel}{\nsk}}
{uncaught (delayed) error}
{\catch{error}{\!{\nsk}}}
{catch towel at 6}
{ \set{foo}{0}
\catch{towel}{\while{\let{\foo<10}}{
foo \foo bar\@{\N}
\if{\let{\foo==6}}{\throw{towel}}{}
\setx{foo}{\let{\foo+1}}
}
}
}
\: \cmp#3
{argument does not parse}
{\cmp{eq}{\nsk}{foo}}
{no such mode}
{\cmp{__}{bar}{foo}}
\: \constant#1
{parse error (not fatal, trailing element)}
{\constant{{(c)} boo {}}}
\: \def#2
{wrong key signature}
{\def{^zut}{foo}}
\: \defined#2
{wrong mode}
{\defined{__}{__}}
\: \defx#2
{wrong key signature}
{\defx{^zut}{foo}}
{parse error}
{\defx{zut}{\nsk}}
\: \dofile#2
{no such file}
{\dofile{no-such-file}{!+}}
\: \dowhile#2
{parse error}
{\dowhile{\nsk}{1}}
{parse error}
{\dowhile{1}{\nsk}}
\: \end#1
{no such env}
{\end{nse}}
{cannot close myenv}
{\end{myenv}}
{can close myenv2}
{\end{myenv2}}
\: \env#3
{cannot define env while in environment}
{\env{myenv3}{foo}{bar}}
\: \eqt#3
{argument does not parse}
{\eqt{eq}{\nsk}{1}}
{no such mode}
{\eqt{__}{1}{1}}
{argument not numeric I}
{\eqt{eq}{aap}{\one}}
{argument not numeric II}
{\eqt{eq}{aap}{\zero}}
\: \eval#1
{parse error}
{\eval{\nsk}}
\: \f#2
{no such mode}
{\f{nsm}{2.5}}
{overflow I ?}
{\f{sign}{111111111111111111111111111111}}
{overflow II ?}
{\f{sign}{3e100000}}
{parse error}
{\f{sign}{\nsk}}
\: \finsert#1
{parse error}
{\finsert{\nsk}}
\: \format#1 \: todo: more format torturing.
\: \formatted#2 \: hum, not very exciting.
\: \fv#2
{no such mode}
{\fv{nsm}{{1}{2}{3}}}
{parse error}
{\fv{sum}{{\zero}{\one}{\nsk}}}
{this should work}
{\fv{max}{{\zero}{\one}{2}}}
\: \if#3
{parse error condition}
{\if{\nsk}{}{}}
{parse error if}
{\if{1}{\nsk}{}}
{parse error else}
{\if{0}{}{\nsk}}
\: \inspect#4 \: leave this until after inspect#4 rewrite.
\: \f#3
{arithmetic exception in f}
{\f{div}{1}{0}}
\: let
{syntax error in let}
{\let{1+}}
{another syntax error in let}
{\let{1+sin(1,)}}
{callback error in let}
{\let{\nsk}}
{nested callback error in let}
{\let{\let{\nsk}}}
{arithmetic exception in let}
{\let{1/0}}
{overflow in let}
{\let{300**300}}
{complicated and correct let expression, including redundant callbacks}
{\let{\let{sin(\let{\one})}**2+\let{cos(\let{\one})}**2}}
{complicated and failing let expression}
{\let{\let{sin(\let{\one})}**2+\let{cos(\let{1/0})}**2}}
\: \length#1
{parse error}
{\length{\nsk}}
\: \pop#1 \: under/overflow tested elsewhere.
{no such dictionary stack}
{\pop{nsds}}
\: \protect#1 \: what could be problematic here ?
\: \push#1
{no such dictionary stack}
{\push{nsds}}
\: \roman#1
{parse error}
{\roman{\nsk}}
{convert error}
{\roman{abc}}
\: \set#2
\: \setx#2
\: system
{absent system call}
{\system{#}}
{failing system call}
{\system{ls}{{-#}}}
{finally a systemcall that should succeed}
{\system{true}}
{should close myenv}
{\end{myenv}}
\: \special#1 \: it'll mostly work.
\: \switch#2
{parse error in pivot}
{\switch{\nsk}{{}{}}}
{parse error in clause}
{\switch{foo}{{\nsk}{A}{b}{B}}}
{parse error in case}
{\switch{foo}{{foo}{\nsk}{b}{B}}}
\: \table#5 \: not motivated; it is a sitting duck anyway.
\: \tr#2
{this should work}
{\tr{{from}{a-z}{to}{A-Z}{squash}{A-Z}}{squash the bookkeeper}}
\: \trace#1
{parse error}
{\trace{\nsk}}
\: \try#1 \: todotodo
\: \ucase#1
{parse error}
{\textmap{{word}{ucase}}{\nsk}}
\: \undef#1
{wrong signature}
{\undef{!}}
\: \vanish#1
{parse error}
{\vanish{\nsk}}
\: \while#2
{parse error condition}
{\while{\nsk}{}}
{parse error body}
{\while{1}{\nsk}}
\: \write#3
{open error}
{\write{/no/such/file}{copy}{foo}}
{no such filter}
{\write{/dev/null}{nsf}{foo}}
{parse error}
{\write{/dev/null}{copy}{\nsk}}
{throw}
{\write{/dev/null}{copy}{\throw{towel}}}
\: \writeto#1
\: {open error}
\: {\writeto{/no/such/file}}
\:
\: this is in fact fatal, currently. too much stress.
\: \zinsert#1
{inline file should work}
{\zinsert{monkey}}
{parse error}
{\zinsert{\nsk}}
{inline file with parse error}
{\eval{\zinsert{fox}}}
\: delay scope
{delay parse error}
{\write{\__fnout__}{device}{\!{\nsk}}}
\:
\: if not wrapped in write it is only seen by output,
\: not by digest, so uncatchable.
}
}
Done with \ct error tests.
\={monkey}=
\zero \one monkey see monkey do
\==
\={fox}=
\zero \one \nsk
\==
|