• R/O
  • SSH

kink: Commit

Kink runtime


Commit MetaInfo

Revisionb0a1b6e5e0c43b7873e08faa8109858ccbc89000 (tree)
Time2023-03-16 22:04:06
Authormiyakawataku
Commitermiyakawataku

Log Message

replace CONTROL.try in tests of num vals

Change Summary

Incremental Difference

diff -r b2f352d29be0 -r b0a1b6e5e0c4 src/test/kink/NUM_DIV_test.kn
--- a/src/test/kink/NUM_DIV_test.kn Thu Mar 16 21:52:34 2023 +0900
+++ b/src/test/kink/NUM_DIV_test.kn Thu Mar 16 22:04:06 2023 +0900
@@ -44,41 +44,45 @@
4444 :op = VARREF.new(Num_div Op_name).load
4545
4646 TEST.test('is a num, in {}'.format(Op_name)){
47- CONTROL.try(
47+ CONTROL.xtry(
4848 { op[Num_div](nada) }
4949 {(:R) raise('got {}'.format(R.repr)) }
50- {(:Msg :Traces)
51- Msg.have_slice?('.' + Op_name) && Msg.have_slice?('nada') || reraise(Msg Traces)
50+ {(:Exc)
51+ :Msg = Exc.message
52+ Msg.have_slice?('.' + Op_name) && Msg.have_slice?('nada') || Exc.raise
5253 }
5354 )
5455 }
5556
5657 TEST.test('is an int, in {}'.format(Op_name)){
57- CONTROL.try(
58+ CONTROL.xtry(
5859 { op[Num_div](0.5) }
5960 {(:R) raise('got {}'.format(R.repr)) }
60- {(:Msg :Traces)
61- Msg.have_slice?('.' + Op_name) && Msg.have_slice?('0.5') || reraise(Msg Traces)
61+ {(:Exc)
62+ :Msg = Exc.message
63+ Msg.have_slice?('.' + Op_name) && Msg.have_slice?('0.5') || Exc.raise
6264 }
6365 )
6466 }
6567
6668 TEST.test('is greater than or equal to INT_MIN, in {}'.format(Op_name)){
67- CONTROL.try(
69+ CONTROL.xtry(
6870 { op[Num_div](-2147483649) }
6971 {(:R) raise('got {}'.format(R.repr)) }
70- {(:Msg :Traces)
71- Msg.have_slice?('.' + Op_name) && Msg.have_slice?('-2147483649') || reraise(Msg Traces)
72+ {(:Exc)
73+ :Msg = Exc.message
74+ Msg.have_slice?('.' + Op_name) && Msg.have_slice?('-2147483649') || Exc.raise
7275 }
7376 )
7477 }
7578
7679 TEST.test('is greater than or equal to INT_MAX, in {}'.format(Op_name)){
77- CONTROL.try(
80+ CONTROL.xtry(
7881 { op[Num_div](2147483648) }
7982 {(:R) raise('got {}'.format(R.repr)) }
80- {(:Msg :Traces)
81- Msg.have_slice?('.' + Op_name) && Msg.have_slice?('2147483648') || reraise(Msg Traces)
83+ {(:Exc)
84+ :Msg = Exc.message
85+ Msg.have_slice?('.' + Op_name) && Msg.have_slice?('2147483648') || Exc.raise
8286 }
8387 )
8488 }
@@ -227,11 +231,12 @@
227231 TEST.group('NUM_DIV.new'){ # {{{1
228232 TEST.group('check Dividend'){
229233 TEST.test('is a num'){
230- CONTROL.try(
234+ CONTROL.xtry(
231235 { NUM_DIV.new(nada 3) }
232236 {(:R) raise('got {}'.format(R.repr)) }
233- {(:Msg :Traces)
234- Msg.have_slice?('NUM_DIV.new') && Msg.have_slice?('nada') || reraise(Msg Traces)
237+ {(:Exc)
238+ :Msg = Exc.message
239+ Msg.have_slice?('NUM_DIV.new') && Msg.have_slice?('nada') || Exc.raise
235240 }
236241 )
237242 }
@@ -239,31 +244,34 @@
239244
240245 TEST.group('check Divisor'){
241246 TEST.test('is a num'){
242- CONTROL.try(
247+ CONTROL.xtry(
243248 { NUM_DIV.new(2 nada) }
244249 {(:R) raise('got {}'.format(R.repr)) }
245- {(:Msg :Traces)
246- Msg.have_slice?('NUM_DIV.new') && Msg.have_slice?('nada') || reraise(Msg Traces)
250+ {(:Exc)
251+ :Msg = Exc.message
252+ Msg.have_slice?('NUM_DIV.new') && Msg.have_slice?('nada') || Exc.raise
247253 }
248254 )
249255 }
250256
251257 TEST.test('is not zero'){
252- CONTROL.try(
258+ CONTROL.xtry(
253259 { NUM_DIV.new(2 0) }
254260 {(:R) raise('got {}'.format(R.repr)) }
255- {(:Msg :Traces)
256- Msg.have_slice?('NUM_DIV.new') && Msg.have_slice?('0') || reraise(Msg Traces)
261+ {(:Exc)
262+ :Msg = Exc.message
263+ Msg.have_slice?('NUM_DIV.new') && Msg.have_slice?('0') || Exc.raise
257264 }
258265 )
259266 }
260267
261268 TEST.test('is not zero, regardless of scale'){
262- CONTROL.try(
269+ CONTROL.xtry(
263270 { NUM_DIV.new(2 0.0) }
264271 {(:R) raise('got {}'.format(R.repr)) }
265- {(:Msg :Traces)
266- Msg.have_slice?('NUM_DIV.new') && Msg.have_slice?('0.0') || reraise(Msg Traces)
272+ {(:Exc)
273+ :Msg = Exc.message
274+ Msg.have_slice?('NUM_DIV.new') && Msg.have_slice?('0.0') || Exc.raise
267275 }
268276 )
269277 }
diff -r b2f352d29be0 -r b0a1b6e5e0c4 src/test/kink/NUM_test.kn
--- a/src/test/kink/NUM_test.kn Thu Mar 16 21:52:34 2023 +0900
+++ b/src/test/kink/NUM_test.kn Thu Mar 16 22:04:06 2023 +0900
@@ -46,21 +46,23 @@
4646
4747 TEST.group('check Mantissa'){
4848 TEST.test('is a num'){
49- CONTROL.try(
49+ CONTROL.xtry(
5050 { NUM.new(nada 2) }
5151 {(:R) raise('got {}'.format(R.repr)) }
52- {(:Msg :Traces)
53- Msg.have_slice?('NUM.new') && Msg.have_slice?('nada') || reraise(Msg Traces)
52+ {(:Exc)
53+ :Msg = Exc.message
54+ Msg.have_slice?('NUM.new') && Msg.have_slice?('nada') || Exc.raise
5455 }
5556 )
5657 }
5758
5859 TEST.test('is an int'){
59- CONTROL.try(
60+ CONTROL.xtry(
6061 { NUM.new(1.2 2) }
6162 {(:R) raise('got {}'.format(R.repr)) }
62- {(:Msg :Traces)
63- Msg.have_slice?('NUM.new') && Msg.have_slice?('1.2') || reraise(Msg Traces)
63+ {(:Exc)
64+ :Msg = Exc.message
65+ Msg.have_slice?('NUM.new') && Msg.have_slice?('1.2') || Exc.raise
6466 }
6567 )
6668 }
@@ -68,41 +70,43 @@
6870
6971 TEST.group('check Scale'){
7072 TEST.test('is a num'){
71- CONTROL.try(
73+ CONTROL.xtry(
7274 { NUM.new(12345 nada) }
7375 {(:R) raise('got {}'.format(R.repr)) }
74- {(:Msg :Traces)
75- Msg.have_slice?('NUM.new') && Msg.have_slice?('nada') || reraise(Msg Traces)
76+ {(:Exc)
77+ :Msg = Exc.message
78+ Msg.have_slice?('NUM.new') && Msg.have_slice?('nada') || Exc.raise
7679 }
7780 )
7881 }
7982
8083 TEST.test('is an int'){
81- CONTROL.try(
84+ CONTROL.xtry(
8285 { NUM.new(12345 3.14) }
8386 {(:R) raise('got {}'.format(R.repr)) }
84- {(:Msg :Traces)
85- Msg.have_slice?('NUM.new') && Msg.have_slice?('3.14') || reraise(Msg Traces)
87+ {(:Exc)
88+ :Msg = Exc.message
89+ Msg.have_slice?('NUM.new') && Msg.have_slice?('3.14') || Exc.raise
8690 }
8791 )
8892 }
8993
9094 TEST.test('does not underflow'){
91- CONTROL.try(
95+ CONTROL.xtry(
9296 { NUM.new(1 (-(1 << 31)) - 1) }
9397 {(:R) raise('got {}'.format(R.repr)) }
94- {(:Msg :Traces)
95- Msg.have_slice?('NUM.new') || reraise(Msg Traces)
98+ {(:Exc)
99+ Exc.message.have_slice?('NUM.new') || Exc.raise
96100 }
97101 )
98102 }
99103
100104 TEST.test('does not overflow'){
101- CONTROL.try(
105+ CONTROL.xtry(
102106 { NUM.new(1 1 << 31) }
103107 {(:R) raise('got {}'.format(R.repr)) }
104- {(:Msg :Traces)
105- Msg.have_slice?('NUM.new') || reraise(Msg Traces)
108+ {(:Exc)
109+ Exc.message.have_slice?('NUM.new') || Exc.raise
106110 }
107111 )
108112 }
@@ -156,47 +160,52 @@
156160 Result == [] || raise('got {}'.format(Result.repr))
157161 }
158162 TEST.test('raise exception for too small radix'){
159- CONTROL.try(
163+ CONTROL.xtry(
160164 { NUM.parse_int('000' 1) }
161165 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
162- {(:Msg :Traces)
163- Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('1') || reraise(Msg Traces)
166+ {(:Exc)
167+ :Msg = Exc.message
168+ Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('1') || Exc.raise
164169 }
165170 )
166171 }
167172 TEST.test('raise exception for too big radix'){
168- CONTROL.try(
173+ CONTROL.xtry(
169174 { NUM.parse_int('Zzz' 37) }
170175 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
171- {(:Msg :Traces)
172- Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('37') || reraise(Msg Traces)
176+ {(:Exc)
177+ :Msg = Exc.message
178+ Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('37') || Exc.raise
173179 }
174180 )
175181 }
176182 TEST.test('raise exception for non-num radix'){
177- CONTROL.try(
183+ CONTROL.xtry(
178184 { NUM.parse_int('42' nada) }
179185 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
180- {(:Msg :Traces)
181- Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('nada') || reraise(Msg Traces)
186+ {(:Exc)
187+ :Msg = Exc.message
188+ Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('nada') || Exc.raise
182189 }
183190 )
184191 }
185192 TEST.test('raise exception for non-int radix'){
186- CONTROL.try(
193+ CONTROL.xtry(
187194 { NUM.parse_int('42' 3.14) }
188195 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
189- {(:Msg :Traces)
190- Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('3.14') || reraise(Msg Traces)
196+ {(:Exc)
197+ :Msg = Exc.message
198+ Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('3.14') || Exc.raise
191199 }
192200 )
193201 }
194202 TEST.test('raise exception for non-str Str'){
195- CONTROL.try(
203+ CONTROL.xtry(
196204 { NUM.parse_int(nada 10) }
197205 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
198- {(:Msg :Traces)
199- Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('nada') || reraise(Msg Traces)
206+ {(:Exc)
207+ :Msg = Exc.message
208+ Msg.have_slice?('NUM.parse_int') && Msg.have_slice?('nada') || Exc.raise
200209 }
201210 )
202211 }
@@ -279,11 +288,12 @@
279288 }
280289
281290 TEST.test('raise an exception if the arg is not str'){
282- CONTROL.try(
291+ CONTROL.xtry(
283292 { NUM.parse_decimal(nada) }
284293 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
285- {(:Msg :Traces)
286- Msg.have_slice?('NUM.parse_decimal') && Msg.have_slice?('nada') || reraise(Msg Traces)
294+ {(:Exc)
295+ :Msg = Exc.message
296+ Msg.have_slice?('NUM.parse_decimal') && Msg.have_slice?('nada') || Exc.raise
287297 }
288298 )
289299 }
@@ -306,11 +316,12 @@
306316 }
307317
308318 TEST.test('checks arg type'){
309- CONTROL.try(
319+ CONTROL.xtry(
310320 { 42.show{(:C) C.plus_sign(nada) } }
311321 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
312- {(:Msg :Traces)
313- Msg.have_slice?('.plus_sign') && Msg.have_slice?('nada') || reraise(Msg Traces)
322+ {(:Exc)
323+ :Msg = Exc.message
324+ Msg.have_slice?('.plus_sign') && Msg.have_slice?('nada') || Exc.raise
314325 }
315326 )
316327 }
@@ -332,11 +343,12 @@
332343 }
333344
334345 TEST.test('checks arg type'){
335- CONTROL.try(
346+ CONTROL.xtry(
336347 { (-42).show{(:C) C.minus_sign(nada) } }
337348 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
338- {(:Msg :Traces)
339- Msg.have_slice?('.minus_sign') && Msg.have_slice?('nada') || reraise(Msg Traces)
349+ {(:Exc)
350+ :Msg = Exc.message
351+ Msg.have_slice?('.minus_sign') && Msg.have_slice?('nada') || Exc.raise
340352 }
341353 )
342354 }
@@ -372,22 +384,24 @@
372384 }
373385
374386 TEST.test('.group_sep checks arg type'){
375- CONTROL.try(
387+ CONTROL.xtry(
376388 { 42.show{(:C) C.group_sep(nada) } }
377389 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
378- {(:Msg :Traces)
379- Msg.have_slice?('.group_sep') && Msg.have_slice?('nada') || reraise(Msg Traces)
390+ {(:Exc)
391+ :Msg = Exc.message
392+ Msg.have_slice?('.group_sep') && Msg.have_slice?('nada') || Exc.raise
380393 }
381394 )
382395 }
383396
384397 [nada 0 1.5].each{(:Len)
385398 TEST.test('.group_len checks invalid len {}'.format(Len.repr)){
386- CONTROL.try(
399+ CONTROL.xtry(
387400 { 12345.show{(:C) C.group_len(Len) } }
388401 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
389- {(:Msg :Traces)
390- Msg.have_slice?('.group_len') && Msg.have_slice?(Len.repr) || reraise(Msg Traces)
402+ {(:Exc)
403+ :Msg = Exc.message
404+ Msg.have_slice?('.group_len') && Msg.have_slice?(Len.repr) || Exc.raise
391405 }
392406 )
393407 }
@@ -409,11 +423,12 @@
409423 }
410424
411425 TEST.test('checks the arg is str'){
412- CONTROL.try(
426+ CONTROL.xtry(
413427 { 42.show{(:C) C.decimal_sep(nada) } }
414428 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
415- {(:Msg :Traces)
416- Msg.have_slice?('.decimal_sep') && Msg.have_slice?('nada') || reraise(Msg Traces)
429+ {(:Exc)
430+ :Msg = Exc.message
431+ Msg.have_slice?('.decimal_sep') && Msg.have_slice?('nada') || Exc.raise
417432 }
418433 )
419434 }
@@ -456,11 +471,12 @@
456471
457472 [nada (-1) 0 1.1].each{(:Len)
458473 TEST.test('checks invalid arg {}'.format(Len.repr)){
459- CONTROL.try(
474+ CONTROL.xtry(
460475 { 42.show{(:C) C.pad_zero(Len) } }
461476 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
462- {(:Msg :Traces)
463- Msg.have_slice?('.pad_zero') && Msg.have_slice?(Len.repr) || reraise(Msg Traces)
477+ {(:Exc)
478+ :Msg = Exc.message
479+ Msg.have_slice?('.pad_zero') && Msg.have_slice?(Len.repr) || Exc.raise
464480 }
465481 )
466482 }
@@ -492,21 +508,23 @@
492508 }
493509
494510 TEST.test('rejects positive scale'){
495- CONTROL.try(
511+ CONTROL.xtry(
496512 { 42.show{(:Conf) Conf.radix(10.000) } }
497513 {(:R) raise('got {}'.format(R.repr)) }
498- {(:Msg :Traces)
499- Msg.have_slice?('.radix') && Msg.have_slice?('10.000') || reraise(Msg Traces)
514+ {(:Exc)
515+ :Msg = Exc.message
516+ Msg.have_slice?('.radix') && Msg.have_slice?('10.000') || Exc.raise
500517 }
501518 )
502519 }
503520
504521 TEST.test('rejects negative scale'){
505- CONTROL.try(
522+ CONTROL.xtry(
506523 { 42.show{(:Conf) Conf.radix(NUM.new(1 (-1))) } }
507524 {(:R) raise('got {}'.format(R.repr)) }
508- {(:Msg :Traces)
509- Msg.have_slice?('.radix') && Msg.have_slice?('-1') || reraise(Msg Traces)
525+ {(:Exc)
526+ :Msg = Exc.message
527+ Msg.have_slice?('.radix') && Msg.have_slice?('-1') || Exc.raise
510528 }
511529 )
512530 }
@@ -519,34 +537,37 @@
519537 }
520538
521539 TEST.test('reject non-int when radix is not 10'){
522- CONTROL.try(
540+ CONTROL.xtry(
523541 { 3.14.show{(:C) C.radix(16) } }
524542 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
525- {(:Msg :Traces)
543+ {(:Exc)
544+ :Msg = Exc.message
526545 Msg.have_slice?('show') && Msg.have_slice?('3.14')
527- && Msg.have_slice?('16') && Msg.have_slice?('10') || reraise(Msg Traces)
546+ && Msg.have_slice?('16') && Msg.have_slice?('10') || Exc.raise
528547 }
529548 )
530549 }
531550
532551 TEST.test('reject scale!=0 when radix is not 10'){
533- CONTROL.try(
552+ CONTROL.xtry(
534553 { 255.00.show{(:C) C.radix(16) } }
535554 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
536- {(:Msg :Traces)
555+ {(:Exc)
556+ :Msg = Exc.message
537557 Msg.have_slice?('show') && Msg.have_slice?('255.00')
538- && Msg.have_slice?('16') && Msg.have_slice?('10') || reraise(Msg Traces)
558+ && Msg.have_slice?('16') && Msg.have_slice?('10') || Exc.raise
539559 }
540560 )
541561 }
542562
543563 [nada 1 37 10.5].each{(:Invalid_radix)
544564 TEST.test('check invalid radix {}'.format(Invalid_radix.repr)){
545- CONTROL.try(
565+ CONTROL.xtry(
546566 { 42.show{(:C) C.radix(Invalid_radix) } }
547567 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
548- {(:Msg :Traces)
549- Msg.have_slice?('.radix') && Msg.have_slice?(Invalid_radix.repr) || reraise(Msg Traces)
568+ {(:Exc)
569+ :Msg = Exc.message
570+ Msg.have_slice?('.radix') && Msg.have_slice?(Invalid_radix.repr) || Exc.raise
550571 }
551572 )
552573 }
@@ -612,31 +633,32 @@
612633 }
613634
614635 TEST.test('reject 0 pad len'){
615- CONTROL.try(
636+ CONTROL.xtry(
616637 { 0xff.show{(:C) C.spec('00') } }
617638 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
618- {(:Msg :Traces)
619- Msg.have_slice?('.spec') || reraise(Msg Traces)
639+ {(:Exc)
640+ Exc.message.have_slice?('.spec') || Exc.raise
620641 }
621642 )
622643 }
623644
624645 TEST.test('check len is specified for pad_zero'){
625- CONTROL.try(
646+ CONTROL.xtry(
626647 { 0xff.show{(:C) C.spec('0') } }
627648 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
628- {(:Msg :Traces)
629- Msg.have_slice?('.spec') || reraise(Msg Traces)
649+ {(:Exc)
650+ Exc.message.have_slice?('.spec') || Exc.raise
630651 }
631652 )
632653 }
633654
634655 TEST.test('check unknown spec'){
635- CONTROL.try(
656+ CONTROL.xtry(
636657 { 0xff.show{(:C) C.spec(',!!!') } }
637658 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
638- {(:Msg :Traces)
639- Msg.have_slice?('.spec') && Msg.have_slice?('!!!') || reraise(Msg Traces)
659+ {(:Exc)
660+ :Msg = Exc.message
661+ Msg.have_slice?('.spec') && Msg.have_slice?('!!!') || Exc.raise
640662 }
641663 )
642664 }
@@ -661,11 +683,12 @@
661683 }
662684
663685 TEST.test('checks that the arg is locale'){
664- CONTROL.try(
686+ CONTROL.xtry(
665687 { 42.show{(:C) C.locale(nada) } }
666688 {(:R) raise('got {}'.format(R.repr)) }
667- {(:Msg :Traces)
668- Msg.have_slice?('nada') && Msg.have_slice?('.locale') || reraise(Msg Traces)
689+ {(:Exc)
690+ :Msg = Exc.message
691+ Msg.have_slice?('nada') && Msg.have_slice?('.locale') || Exc.raise
669692 }
670693 )
671694 }
@@ -704,13 +727,12 @@
704727 # }}}2
705728
706729 TEST.test('._show_num provides Conf, which checks spec is str'){
707- CONTROL.try(
730+ CONTROL.xtry(
708731 { 42.show{(:S) S.spec(nada) } }
709732 {(:Result) raise('expected an exception, but got ' + Result.repr) }
710- {(:Msg :Traces)
711- Msg.have_slice?('.spec') && Msg.have_slice?('str') || raise(
712- 'got ' + Msg.repr + ' on ' + Traces.repr
713- )
733+ {(:Exc)
734+ :Msg = Exc.message
735+ Msg.have_slice?('.spec') && Msg.have_slice?('str') || Exc.raise
714736 }
715737 )
716738 }
diff -r b2f352d29be0 -r b0a1b6e5e0c4 src/test/kink/num_val_test.kn
--- a/src/test/kink/num_val_test.kn Thu Mar 16 21:52:34 2023 +0900
+++ b/src/test/kink/num_val_test.kn Thu Mar 16 22:04:06 2023 +0900
@@ -56,63 +56,58 @@
5656 }
5757
5858 TEST.test('(-1).times raises an exception'){
59- CONTROL.try(
59+ CONTROL.xtry(
6060 { (-1).times }
6161 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
62- {(:Msg :Traces)
63- Msg.have_slice?('Num.times') && Msg.have_slice?('-1') || raise(
64- 'got Msg {} on {}'.format(Msg.repr Traces.repr)
65- )
62+ {(:Exc)
63+ :Msg = Exc.message
64+ Msg.have_slice?('Num.times') && Msg.have_slice?('-1') || Exc.raise
6665 }
6766 )
6867 }
6968
7069 TEST.test('1.5.times raises an exception'){
71- CONTROL.try(
70+ CONTROL.xtry(
7271 { 1.5.times }
7372 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
74- {(:Msg :Traces)
75- Msg.have_slice?('Num.times') && Msg.have_slice?('1.5') || raise(
76- 'got Msg {} on {}'.format(Msg.repr Traces.repr)
77- )
73+ {(:Exc)
74+ :Msg = Exc.message
75+ Msg.have_slice?('Num.times') && Msg.have_slice?('1.5') || Exc.raise
7876 }
7977 )
8078 }
8179
8280 TEST.test('1.0.times raises an exception'){
83- CONTROL.try(
81+ CONTROL.xtry(
8482 { 1.0.times }
8583 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
86- {(:Msg :Traces)
87- Msg.have_slice?('Num.times') && Msg.have_slice?('1.0') || raise(
88- 'got Msg {} on {}'.format(Msg.repr Traces.repr)
89- )
84+ {(:Exc)
85+ :Msg = Exc.message
86+ Msg.have_slice?('Num.times') && Msg.have_slice?('1.0') || Exc.raise
9087 }
9188 )
9289 }
9390
9491 TEST.test('Num.times.ifun checks the type of $proc'){
9592 :ifun = 10.times.ifun
96- CONTROL.try(
93+ CONTROL.xtry(
9794 { ifun(nada {}) }
9895 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
99- {(:Msg :Traces)
100- Msg.have_slice?('Num.times-ifun') && Msg.have_slice?('fun') || raise(
101- 'got Msg {} on {}'.format(Msg.repr Traces.repr)
102- )
96+ {(:Exc)
97+ :Msg = Exc.message
98+ Msg.have_slice?('Num.times-ifun') && Msg.have_slice?('fun') || Exc.raise
10399 }
104100 )
105101 }
106102
107103 TEST.test('Num.times.ifun checks the type of $fin'){
108104 :ifun = 10.times.ifun
109- CONTROL.try(
105+ CONTROL.xtry(
110106 { ifun({(:H :t) } nada) }
111107 {(:Result) raise('expected an exception, but got {}'.format(Result.repr)) }
112- {(:Msg :Traces)
113- Msg.have_slice?('Num.times-ifun') && Msg.have_slice?('fun') || raise(
114- 'got Msg {} on {}'.format(Msg.repr Traces.repr)
115- )
108+ {(:Exc)
109+ :Msg = Exc.message
110+ Msg.have_slice?('Num.times-ifun') && Msg.have_slice?('fun') || Exc.raise
116111 }
117112 )
118113 }
@@ -184,13 +179,11 @@
184179 }
185180
186181 TEST.test('Num.show checks recv type'){
187- CONTROL.try(
182+ CONTROL.xtry(
188183 { (-42).show[nada]{} }
189184 {(:Result) raise('expected an exception, but got ' + Result.repr) }
190- {(:Msg :Traces)
191- Msg.have_slice?('Num.show') || raise(
192- 'expected Msg containing "Num.show" but got ' + Msg.repr + ' on ' + Traces.repr
193- )
185+ {(:Exc)
186+ Exc.message.have_slice?('Num.show') || Exc.raise
194187 }
195188 )
196189 }
Show on old repository browser