Revision | 59104b25d065177653b7333de682127cb6275ed9 (tree) |
---|---|
Time | 2023-03-17 22:14:20 |
Author | miyakawataku |
Commiter | miyakawataku |
replace CONTROL.try in tests of PROCESS mod
@@ -82,21 +82,22 @@ | ||
82 | 82 | |
83 | 83 | TEST.test('raise exception when absent'){ |
84 | 84 | :Env_map = FLAT_MAP.of('HOME' '/home/foo') |
85 | - CONTROL.try( | |
85 | + CONTROL.xtry( | |
86 | 86 | { PROCESS._aux_env('PATH' Env_map) } |
87 | 87 | {(:R) raise('got {}'.format(R.repr)) } |
88 | - {(:Msg :Traces) | |
89 | - Msg.have_slice?('PROCESS.env') || reraise(Msg Traces) | |
88 | + {(:Exc) | |
89 | + Exc.message.have_slice?('PROCESS.env') || Exc.raise | |
90 | 90 | } |
91 | 91 | ) |
92 | 92 | } |
93 | 93 | |
94 | 94 | TEST.test('requires str'){ |
95 | - CONTROL.try( | |
95 | + CONTROL.xtry( | |
96 | 96 | { PROCESS.env(nada) } |
97 | 97 | {(:R) raise('got {}'.format(R.repr)) } |
98 | - {(:Msg :Traces) | |
99 | - Msg.have_slice?('nada') && Msg.have_slice?('.env') || reraise(Msg Traces) | |
98 | + {(:Exc) | |
99 | + :Msg = Exc.message | |
100 | + Msg.have_slice?('nada') && Msg.have_slice?('.env') || Exc.raise | |
100 | 101 | } |
101 | 102 | ) |
102 | 103 | } |
@@ -115,11 +116,12 @@ | ||
115 | 116 | } |
116 | 117 | |
117 | 118 | TEST.test('requires str'){ |
118 | - CONTROL.try( | |
119 | + CONTROL.xtry( | |
119 | 120 | { PROCESS.have_env?(nada) } |
120 | 121 | {(:R) raise('got {}'.format(R.repr)) } |
121 | - {(:Msg :Traces) | |
122 | - Msg.have_slice?('nada') && Msg.have_slice?('.have_env?') || reraise(Msg Traces) | |
122 | + {(:Exc) | |
123 | + :Msg = Exc.message | |
124 | + Msg.have_slice?('nada') && Msg.have_slice?('.have_env?') || Exc.raise | |
123 | 125 | } |
124 | 126 | ) |
125 | 127 | } |
@@ -159,41 +161,45 @@ | ||
159 | 161 | } |
160 | 162 | |
161 | 163 | TEST.test('cannot convert too small status'){ |
162 | - CONTROL.try( | |
164 | + CONTROL.xtry( | |
163 | 165 | { PROCESS._check_exit_status(-2147483649) } |
164 | 166 | {(:R) raise('got {}'.format(R.repr)) } |
165 | - {(:Msg :Traces) | |
166 | - Msg.have_slice?('PROCESS.exit') && Msg.have_slice?('-2147483649') || reraise(Msg Traces) | |
167 | + {(:Exc) | |
168 | + :Msg = Exc.message | |
169 | + Msg.have_slice?('PROCESS.exit') && Msg.have_slice?('-2147483649') || Exc.raise | |
167 | 170 | } |
168 | 171 | ) |
169 | 172 | } |
170 | 173 | |
171 | 174 | TEST.test('cannot convert too big status'){ |
172 | - CONTROL.try( | |
175 | + CONTROL.xtry( | |
173 | 176 | { PROCESS._check_exit_status(2147483648) } |
174 | 177 | {(:R) raise('got {}'.format(R.repr)) } |
175 | - {(:Msg :Traces) | |
176 | - Msg.have_slice?('PROCESS.exit') && Msg.have_slice?('2147483648') || reraise(Msg Traces) | |
178 | + {(:Exc) | |
179 | + :Msg = Exc.message | |
180 | + Msg.have_slice?('PROCESS.exit') && Msg.have_slice?('2147483648') || Exc.raise | |
177 | 181 | } |
178 | 182 | ) |
179 | 183 | } |
180 | 184 | |
181 | 185 | TEST.test('cannot convert nada'){ |
182 | - CONTROL.try( | |
186 | + CONTROL.xtry( | |
183 | 187 | { PROCESS._check_exit_status(nada) } |
184 | 188 | {(:R) raise('got {}'.format(R.repr)) } |
185 | - {(:Msg :Traces) | |
186 | - Msg.have_slice?('PROCESS.exit') && Msg.have_slice?('nada') || reraise(Msg Traces) | |
189 | + {(:Exc) | |
190 | + :Msg = Exc.message | |
191 | + Msg.have_slice?('PROCESS.exit') && Msg.have_slice?('nada') || Exc.raise | |
187 | 192 | } |
188 | 193 | ) |
189 | 194 | } |
190 | 195 | |
191 | 196 | TEST.test('cannot convert non-int num'){ |
192 | - CONTROL.try( | |
197 | + CONTROL.xtry( | |
193 | 198 | { PROCESS._check_exit_status(3.14) } |
194 | 199 | {(:R) raise('got {}'.format(R.repr)) } |
195 | - {(:Msg :Traces) | |
196 | - Msg.have_slice?('PROCESS.exit') && Msg.have_slice?('3.14') || reraise(Msg Traces) | |
200 | + {(:Exc) | |
201 | + :Msg = Exc.message | |
202 | + Msg.have_slice?('PROCESS.exit') && Msg.have_slice?('3.14') || Exc.raise | |
197 | 203 | } |
198 | 204 | ) |
199 | 205 | } |
@@ -213,31 +219,34 @@ | ||
213 | 219 | |
214 | 220 | TEST.group('Command_and_args'){ # {{{ |
215 | 221 | TEST.test('must be a vec'){ |
216 | - CONTROL.try( | |
222 | + CONTROL.xtry( | |
217 | 223 | { PROCESS.start(nada) } |
218 | 224 | {(:R) raise('got {}'.format(R.repr)) } |
219 | - {(:Msg :Traces) | |
220 | - Msg.have_slice?('PROCESS.start') && Msg.have_slice?('nada') || reraise(Msg Traces) | |
225 | + {(:Exc) | |
226 | + :Msg = Exc.message | |
227 | + Msg.have_slice?('PROCESS.start') && Msg.have_slice?('nada') || Exc.raise | |
221 | 228 | } |
222 | 229 | ) |
223 | 230 | } |
224 | 231 | |
225 | 232 | TEST.test('must have at least one elem'){ |
226 | - CONTROL.try( | |
233 | + CONTROL.xtry( | |
227 | 234 | { PROCESS.start([]) } |
228 | 235 | {(:R) raise('got {}'.format(R.repr)) } |
229 | - {(:Msg :Traces) | |
230 | - Msg.have_slice?('PROCESS.start') && Msg.have_slice?('[]') || reraise(Msg Traces) | |
236 | + {(:Exc) | |
237 | + :Msg = Exc.message | |
238 | + Msg.have_slice?('PROCESS.start') && Msg.have_slice?('[]') || Exc.raise | |
231 | 239 | } |
232 | 240 | ) |
233 | 241 | } |
234 | 242 | |
235 | 243 | TEST.test('all the elems must be strs'){ |
236 | - CONTROL.try( | |
244 | + CONTROL.xtry( | |
237 | 245 | { PROCESS.start(['ls' 42]) } |
238 | 246 | {(:R) raise('got {}'.format(R.repr)) } |
239 | - {(:Msg :Traces) | |
240 | - Msg.have_slice?('PROCESS.start') && Msg.have_slice?('42') || reraise(Msg Traces) | |
247 | + {(:Exc) | |
248 | + :Msg = Exc.message | |
249 | + Msg.have_slice?('PROCESS.start') && Msg.have_slice?('42') || Exc.raise | |
241 | 250 | } |
242 | 251 | ) |
243 | 252 | } |
@@ -299,16 +308,17 @@ | ||
299 | 308 | || raise('got {}'.format(In.repr)) |
300 | 309 | } |
301 | 310 | |
302 | - TEST.test('File_path msut be a str'){ | |
303 | - CONTROL.try( | |
311 | + TEST.test('File_path must be a str'){ | |
312 | + CONTROL.xtry( | |
304 | 313 | { PROCESS._read_start_conf(['ls' '-l']){(:C) |
305 | 314 | C.stdin_from_file(nada) |
306 | 315 | } |
307 | 316 | } |
308 | 317 | {(:R) raise('got {}'.format(R.repr)) } |
309 | - {(:Msg :Traces) | |
318 | + {(:Exc) | |
319 | + :Msg = Exc.message | |
310 | 320 | Msg.have_slice?('nada') && Msg.have_slice?('.stdin_from_file') |
311 | - || reraise(Msg Traces) | |
321 | + || Exc.raise | |
312 | 322 | } |
313 | 323 | ) |
314 | 324 | } |
@@ -359,11 +369,12 @@ | ||
359 | 369 | } |
360 | 370 | |
361 | 371 | TEST.test('File_path must be a str'){ |
362 | - CONTROL.try( | |
372 | + CONTROL.xtry( | |
363 | 373 | { PROCESS._read_start_conf(['ls' '-l']){(:C) C.stdout_to_overwrite(nada) } } |
364 | 374 | {(:R) raise('got {}'.format(R.repr)) } |
365 | - {(:Msg :Traces) | |
366 | - Msg.have_slice?('nada') && Msg.have_slice?('.stdout_to_overwrite') || reraise(Msg Traces) | |
375 | + {(:Exc) | |
376 | + :Msg = Exc.message | |
377 | + Msg.have_slice?('nada') && Msg.have_slice?('.stdout_to_overwrite') || Exc.raise | |
367 | 378 | } |
368 | 379 | ) |
369 | 380 | } |
@@ -387,14 +398,15 @@ | ||
387 | 398 | } |
388 | 399 | |
389 | 400 | TEST.test('File_path must be a str'){ |
390 | - CONTROL.try( | |
401 | + CONTROL.xtry( | |
391 | 402 | { PROCESS._read_start_conf(['ls' '-l']){(:C) |
392 | 403 | C.stdout_to_append(nada) |
393 | 404 | } |
394 | 405 | } |
395 | 406 | {(:R) raise('got {}'.format(R.repr)) } |
396 | - {(:Msg :Traces) | |
397 | - Msg.have_slice?('nada') && Msg.have_slice?('.stdout_to_append') || reraise(Msg Traces) | |
407 | + {(:Exc) | |
408 | + :Msg = Exc.message | |
409 | + Msg.have_slice?('nada') && Msg.have_slice?('.stdout_to_append') || Exc.raise | |
398 | 410 | } |
399 | 411 | ) |
400 | 412 | } |
@@ -444,14 +456,15 @@ | ||
444 | 456 | } |
445 | 457 | |
446 | 458 | TEST.test('File_path must be a str'){ |
447 | - CONTROL.try( | |
459 | + CONTROL.xtry( | |
448 | 460 | { PROCESS._read_start_conf(['ls' '-l']){(:C) |
449 | 461 | C.stderr_to_overwrite(nada) |
450 | 462 | } |
451 | 463 | } |
452 | 464 | {(:R) raise('got {}'.format(R.repr)) } |
453 | - {(:Msg :Traces) | |
454 | - Msg.have_slice?('.stderr_to_overwrite') && Msg.have_slice?('nada') || reraise(Msg Traces) | |
465 | + {(:Exc) | |
466 | + :Msg = Exc.message | |
467 | + Msg.have_slice?('.stderr_to_overwrite') && Msg.have_slice?('nada') || Exc.raise | |
455 | 468 | } |
456 | 469 | ) |
457 | 470 | } |
@@ -474,11 +487,12 @@ | ||
474 | 487 | } |
475 | 488 | |
476 | 489 | TEST.test('File_path must be a str'){ |
477 | - CONTROL.try( | |
490 | + CONTROL.xtry( | |
478 | 491 | { PROCESS._read_start_conf(['ls' '-l']){(:C) C.stderr_to_append(nada) } } |
479 | 492 | {(:R) raise('got {}'.format(R.repr)) } |
480 | - {(:Msg :Traces) | |
481 | - Msg.have_slice?('nada') && Msg.have_slice?('stderr_to_append') || reraise(Msg Traces) | |
493 | + {(:Exc) | |
494 | + :Msg = Exc.message | |
495 | + Msg.have_slice?('nada') && Msg.have_slice?('stderr_to_append') || Exc.raise | |
482 | 496 | } |
483 | 497 | ) |
484 | 498 | } |
@@ -522,11 +536,12 @@ | ||
522 | 536 | } |
523 | 537 | |
524 | 538 | TEST.test('Dir_path must be a str'){ |
525 | - CONTROL.try( | |
539 | + CONTROL.xtry( | |
526 | 540 | { PROCESS.start(['ls']){(:C) C.dir(nada) } } |
527 | 541 | {(:R) raise('got {}'.format(R.repr)) } |
528 | - {(:Msg :Traces) | |
529 | - Msg.have_slice?('nada') && Msg.have_slice?('.dir') || reraise(Msg Traces) | |
542 | + {(:Exc) | |
543 | + :Msg = Exc.message | |
544 | + Msg.have_slice?('nada') && Msg.have_slice?('.dir') || Exc.raise | |
530 | 545 | } |
531 | 546 | ) |
532 | 547 | } |
@@ -545,27 +560,29 @@ | ||
545 | 560 | } |
546 | 561 | |
547 | 562 | TEST.test('Env_name must be a str'){ |
548 | - CONTROL.try( | |
563 | + CONTROL.xtry( | |
549 | 564 | { PROCESS._read_start_conf(['ls' '-l']){(:C) |
550 | 565 | C.set_env(nada 'hello world') |
551 | 566 | } |
552 | 567 | } |
553 | 568 | {(:R) raise('got {}'.format(R.repr)) } |
554 | - {(:Msg :Traces) | |
555 | - Msg.have_slice?('nada') && Msg.have_slice?('set_env') || reraise(Msg Traces) | |
569 | + {(:Exc) | |
570 | + :Msg = Exc.message | |
571 | + Msg.have_slice?('nada') && Msg.have_slice?('set_env') || Exc.raise | |
556 | 572 | } |
557 | 573 | ) |
558 | 574 | } |
559 | 575 | |
560 | 576 | TEST.test('Env_val must be a str'){ |
561 | - CONTROL.try( | |
577 | + CONTROL.xtry( | |
562 | 578 | { PROCESS._read_start_conf(['ls' '-l']){(:C) |
563 | 579 | C.set_env('env_name' nada) |
564 | 580 | } |
565 | 581 | } |
566 | 582 | {(:R) raise('got {}'.format(R.repr)) } |
567 | - {(:Msg :Traces) | |
568 | - Msg.have_slice?('nada') && Msg.have_slice?('set_env') || reraise(Msg Traces) | |
583 | + {(:Exc) | |
584 | + :Msg = Exc.message | |
585 | + Msg.have_slice?('nada') && Msg.have_slice?('set_env') || Exc.raise | |
569 | 586 | } |
570 | 587 | ) |
571 | 588 | } |
@@ -585,14 +602,15 @@ | ||
585 | 602 | } |
586 | 603 | |
587 | 604 | TEST.test('Env_name must be a str'){ |
588 | - CONTROL.try( | |
605 | + CONTROL.xtry( | |
589 | 606 | { PROCESS._read_start_conf(['ls' '-l']){(:C) |
590 | 607 | C.unset_env(nada) |
591 | 608 | } |
592 | 609 | } |
593 | 610 | {(:R) raise('got {}'.format(R.repr)) } |
594 | - {(:Msg :Traces) | |
595 | - Msg.have_slice?('nada') && Msg.have_slice?('unset_env') || reraise(Msg Traces) | |
611 | + {(:Exc) | |
612 | + :Msg = Exc.message | |
613 | + Msg.have_slice?('nada') && Msg.have_slice?('unset_env') || Exc.raise | |
596 | 614 | } |
597 | 615 | ) |
598 | 616 | } |
@@ -646,14 +664,15 @@ | ||
646 | 664 | } |
647 | 665 | |
648 | 666 | TEST.test('success cont must be a fun'){ |
649 | - CONTROL.try( | |
667 | + CONTROL.xtry( | |
650 | 668 | { PROCESS._read_start_conf(['ls' '-l']){(:C) |
651 | 669 | C.on_success(nada) |
652 | 670 | } |
653 | 671 | } |
654 | 672 | {(:R) raise('got {}'.format(R.repr)) } |
655 | - {(:Msg :Traces) | |
656 | - Msg.have_slice?('nada') && Msg.have_slice?('on_success') || reraise(Msg Traces) | |
673 | + {(:Exc) | |
674 | + :Msg = Exc.message | |
675 | + Msg.have_slice?('nada') && Msg.have_slice?('on_success') || Exc.raise | |
657 | 676 | } |
658 | 677 | ) |
659 | 678 | } |
@@ -671,14 +690,15 @@ | ||
671 | 690 | } |
672 | 691 | |
673 | 692 | TEST.test('error cont must be a fun'){ |
674 | - CONTROL.try( | |
693 | + CONTROL.xtry( | |
675 | 694 | { PROCESS._read_start_conf(['ls' '-l']){(:C) |
676 | 695 | C.on_error(nada) |
677 | 696 | } |
678 | 697 | } |
679 | 698 | {(:R) raise('got {}'.format(R.repr)) } |
680 | - {(:Msg :Traces) | |
681 | - Msg.have_slice?('nada') && Msg.have_slice?('on_error') || reraise(Msg Traces) | |
699 | + {(:Exc) | |
700 | + :Msg = Exc.message | |
701 | + Msg.have_slice?('nada') && Msg.have_slice?('on_error') || Exc.raise | |
682 | 702 | } |
683 | 703 | ) |
684 | 704 | } |
@@ -735,11 +755,11 @@ | ||
735 | 755 | CONTROL.with_on_exit{(:on_exit) |
736 | 756 | :Subp = PROCESS.start([_exe_file 'script: {}'.format(Script)]) |
737 | 757 | on_exit{ Subp.wait } |
738 | - CONTROL.try( | |
758 | + CONTROL.xtry( | |
739 | 759 | { Subp.stdin } |
740 | 760 | {(:R) raise('got {}'.format(R.repr)) } |
741 | - {(:Msg :Traces) | |
742 | - Msg.have_slice?('.stdin') || reraise(Msg Traces) | |
761 | + {(:Exc) | |
762 | + Exc.message.have_slice?('.stdin') || Exc.raise | |
743 | 763 | } |
744 | 764 | ) |
745 | 765 | } |
@@ -763,11 +783,11 @@ | ||
763 | 783 | CONTROL.with_on_exit{(:on_exit) |
764 | 784 | :Subp = PROCESS.start([_exe_file 'script: {}'.format(Script)]) |
765 | 785 | on_exit{ Subp.wait } |
766 | - CONTROL.try( | |
786 | + CONTROL.xtry( | |
767 | 787 | { Subp.stdout } |
768 | 788 | {(:R) raise('got {}'.format(R.repr)) } |
769 | - {(:Msg :Traces) | |
770 | - Msg.have_slice?('.stdout') || reraise(Msg Traces) | |
789 | + {(:Exc) | |
790 | + Exc.message.have_slice?('.stdout') || Exc.raise | |
771 | 791 | } |
772 | 792 | ) |
773 | 793 | } |
@@ -792,11 +812,11 @@ | ||
792 | 812 | CONTROL.with_on_exit{(:on_exit) |
793 | 813 | :Subp = PROCESS.start([_exe_file 'script: {}'.format(Script)]) |
794 | 814 | on_exit{ Subp.wait } |
795 | - CONTROL.try( | |
815 | + CONTROL.xtry( | |
796 | 816 | { Subp.stderr } |
797 | 817 | {(:R) raise('got {}'.format(R.repr)) } |
798 | - {(:Msg :Traces) | |
799 | - Msg.have_slice?('.stderr') || reraise(Msg Traces) | |
818 | + {(:Exc) | |
819 | + Exc.message.have_slice?('.stderr') || Exc.raise | |
800 | 820 | } |
801 | 821 | ) |
802 | 822 | } |
@@ -810,11 +830,11 @@ | ||
810 | 830 | C.stderr_to_stdout |
811 | 831 | } |
812 | 832 | on_exit{ Subp.wait } |
813 | - CONTROL.try( | |
833 | + CONTROL.xtry( | |
814 | 834 | { Subp.stderr } |
815 | 835 | {(:R) raise('got {}'.format(R.repr)) } |
816 | - {(:Msg :Traces) | |
817 | - Msg.have_slice?('.stderr') || reraise(Msg Traces) | |
836 | + {(:Exc) | |
837 | + Exc.message.have_slice?('.stderr') || Exc.raise | |
818 | 838 | } |
819 | 839 | ) |
820 | 840 | } |
@@ -851,11 +871,11 @@ | ||
851 | 871 | TEST.test('timeout'){ |
852 | 872 | :Script = ":THREAD.require_from('kink/thread/') THREAD.sleep(5)" |
853 | 873 | :Subp = PROCESS.start([_exe_file 'script: {}'.format(Script)]) |
854 | - CONTROL.try( | |
874 | + CONTROL.xtry( | |
855 | 875 | { Subp.wait{(:C) C.timeout(0.5) } } |
856 | 876 | {(:R) raise('got {}'.format(R.repr)) } |
857 | - {(:Msg :Traces) | |
858 | - Msg.have_slice?('.wait') || reraise(Msg Traces) | |
877 | + {(:Exc) | |
878 | + Exc.message.have_slice?('.wait') || Exc.raise | |
859 | 879 | } |
860 | 880 | ) |
861 | 881 | } |
@@ -903,7 +923,7 @@ | ||
903 | 923 | THREAD.spawn{ |
904 | 924 | Wait_thread.call_method('interrupt' []) |
905 | 925 | } |
906 | - CONTROL.try( | |
926 | + CONTROL.xtry( | |
907 | 927 | { Subp.wait{(:C) |
908 | 928 | C.on_terminate{(:Exit_status) |
909 | 929 | 'exit status: {}'.format(Exit_status.repr) |
@@ -911,7 +931,7 @@ | ||
911 | 931 | } |
912 | 932 | } |
913 | 933 | {(:R) raise('got {}'.format(R.repr)) } |
914 | - {(:Msg :Traces) | |
934 | + {(:Exc) | |
915 | 935 | 'ok; interrupted' |
916 | 936 | } |
917 | 937 | ) |
@@ -929,7 +949,7 @@ | ||
929 | 949 | THREAD.spawn{ |
930 | 950 | Wait_thread.call_method('interrupt' []) |
931 | 951 | } |
932 | - CONTROL.try( | |
952 | + CONTROL.xtry( | |
933 | 953 | { Subp.wait{(:C) |
934 | 954 | C.timeout(1000) |
935 | 955 | C.on_terminate{(:Exit_status) |
@@ -938,7 +958,7 @@ | ||
938 | 958 | } |
939 | 959 | } |
940 | 960 | {(:R) raise('got {}'.format(R.repr)) } |
941 | - {(:Msg :Traces) | |
961 | + {(:Exc) | |
942 | 962 | 'ok; interrupted' |
943 | 963 | } |
944 | 964 | ) |
@@ -962,21 +982,23 @@ | ||
962 | 982 | TEST.group('.timeout'){ # {{{ |
963 | 983 | |
964 | 984 | TEST.test('Seconds must be a num'){ |
965 | - CONTROL.try( | |
985 | + CONTROL.xtry( | |
966 | 986 | { PROCESS._read_wait_conf{(:C) C.timeout(nada) } } |
967 | 987 | {(:R) raise('got {}'.format(R.repr)) } |
968 | - {(:Msg :Traces) | |
969 | - Msg.have_slice?('.timeout') && Msg.have_slice?('nada') || reraise(Msg Traces) | |
988 | + {(:Exc) | |
989 | + :Msg = Exc.message | |
990 | + Msg.have_slice?('.timeout') && Msg.have_slice?('nada') || Exc.raise | |
970 | 991 | } |
971 | 992 | ) |
972 | 993 | } |
973 | 994 | |
974 | 995 | TEST.test('reject negative timeout'){ |
975 | - CONTROL.try( | |
996 | + CONTROL.xtry( | |
976 | 997 | { PROCESS._read_wait_conf{(:C) C.timeout(-0.001) } } |
977 | 998 | {(:R) raise('got {}'.format(R.repr)) } |
978 | - {(:Msg :Traces) | |
979 | - Msg.have_slice?('.timeout') && Msg.have_slice?('-0.001') || reraise(Msg Traces) | |
999 | + {(:Exc) | |
1000 | + :Msg = Exc.message | |
1001 | + Msg.have_slice?('.timeout') && Msg.have_slice?('-0.001') || Exc.raise | |
980 | 1002 | } |
981 | 1003 | ) |
982 | 1004 | } |
@@ -1009,22 +1031,24 @@ | ||
1009 | 1031 | |
1010 | 1032 | # }}} |
1011 | 1033 | TEST.test('.on_terminate requires fun'){ # {{{ |
1012 | - CONTROL.try( | |
1034 | + CONTROL.xtry( | |
1013 | 1035 | { PROCESS._read_wait_conf{(:C) C.on_terminate(nada) } } |
1014 | 1036 | {(:R) raise('got {}'.format(R.repr)) } |
1015 | - {(:Msg :Traces) | |
1016 | - Msg.have_slice?('.on_terminate') && Msg.have_slice?('nada') || reraise(Msg Traces) | |
1037 | + {(:Exc) | |
1038 | + :Msg = Exc.message | |
1039 | + Msg.have_slice?('.on_terminate') && Msg.have_slice?('nada') || Exc.raise | |
1017 | 1040 | } |
1018 | 1041 | ) |
1019 | 1042 | } |
1020 | 1043 | |
1021 | 1044 | # }}} |
1022 | 1045 | TEST.test('.on_timeout'){ # {{{ |
1023 | - CONTROL.try( | |
1046 | + CONTROL.xtry( | |
1024 | 1047 | { PROCESS._read_wait_conf{(:C) C.on_timeout(nada) } } |
1025 | 1048 | {(:R) raise('got {}'.format(R.repr)) } |
1026 | - {(:Msg :Traces) | |
1027 | - Msg.have_slice?('.on_timeout') && Msg.have_slice?('nada') || reraise(Msg Traces) | |
1049 | + {(:Exc) | |
1050 | + :Msg = Exc.message | |
1051 | + Msg.have_slice?('.on_timeout') && Msg.have_slice?('nada') || Exc.raise | |
1028 | 1052 | } |
1029 | 1053 | ) |
1030 | 1054 | } |