@@ -349,7 +349,6 @@ def behaves_as_delay(delay, value)
349
349
end
350
350
end
351
351
352
-
353
352
it 'chains' do
354
353
future0 = future { 1 } . then { |v | v + 2 } # both executed on default FAST_EXECUTOR
355
354
future1 = future0 . then_on ( :fast ) { raise 'boo' } # executed on IO_EXECUTOR
@@ -490,22 +489,28 @@ def behaves_as_delay(delay, value)
490
489
end
491
490
492
491
it 'can be risen when rejected' do
492
+ strip_methods = -> backtrace do
493
+ backtrace . map do |line |
494
+ /^.*:\d +:in/ . match ( line ) [ 0 ] rescue line
495
+ end
496
+ end
497
+
493
498
future = rejected_future TypeError . new
494
- backtrace = caller ; exception = raise future rescue $!
499
+ backtrace = caller ; exception = ( raise future rescue $!)
495
500
expect ( exception ) . to be_a TypeError
496
- expect ( exception . backtrace [ 2 ..- 1 ] ) . to eq backtrace
501
+ expect ( strip_methods [ backtrace ] - strip_methods [ exception . backtrace ] ) . to be_empty
497
502
498
503
exception = TypeError . new
499
504
exception . set_backtrace ( first_backtrace = %W[ /a /b /c ] )
500
505
future = rejected_future exception
501
- backtrace = caller ; exception = raise future rescue $!
506
+ backtrace = caller ; exception = ( raise future rescue $!)
502
507
expect ( exception ) . to be_a TypeError
503
- expect ( exception . backtrace - exception . backtrace [ 3 .. 4 ] ) . to eq ( first_backtrace + backtrace )
508
+ expect ( strip_methods [ first_backtrace + backtrace ] - strip_methods [ exception . backtrace ] ) . to be_empty
504
509
505
510
future = rejected_future ( TypeError . new ) & rejected_future ( TypeError . new )
506
- backtrace = caller ; exception = raise future rescue $!
511
+ backtrace = caller ; exception = ( raise future rescue $!)
507
512
expect ( exception ) . to be_a Concurrent ::MultipleErrors
508
- expect ( exception . backtrace [ 2 ..- 1 ] ) . to eq backtrace
513
+ expect ( strip_methods [ backtrace ] - strip_methods [ exception . backtrace ] ) . to be_empty
509
514
end
510
515
end
511
516
0 commit comments