File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 43
43
out = ruby_exe ( @file , options : "--coverage" )
44
44
out . should =~ /#{ Regexp . escape @file } .+100(\. \d *)?%/
45
45
out . should . include? ( "42" )
46
- $?. should . success?
47
46
end
48
47
49
48
it "works for internal sources" do
50
49
out = ruby_exe ( @file , options : "--coverage --experimental-options --coverage.TrackInternal" )
51
50
out . should =~ /#{ Regexp . escape @file } .+100(\. \d *)?%/
52
51
out . should . include? ( "42" )
53
- $?. should . success?
54
52
end
55
53
end
56
54
@@ -70,9 +68,27 @@ def foo
70
68
RUBY
71
69
out = ruby_exe ( code , options : "--cpusampler" )
72
70
out . should . include? ( ":kill" )
71
+ out . should . include? ( "Sampling Histogram" )
73
72
out . should . include? ( "Kernel#loop" )
74
73
out . should_not . include? ( 'KillException' )
75
- $?. should . success?
74
+ end
75
+
76
+ it "works if interrupted by Ctrl+C" do
77
+ code = <<~RUBY
78
+ def foo
79
+ n = 0
80
+ loop { yield_self { n += 1 } }
81
+ n
82
+ end
83
+ Thread.new { foo }
84
+ sleep 0.1
85
+ Process.kill :INT, Process.pid
86
+ sleep
87
+ RUBY
88
+ out = ruby_exe ( code , options : "--cpusampler" , args : "2>&1" , exit_status : :SIGINT )
89
+ out . should . include? ( 'Interrupt (Interrupt)' )
90
+ out . should . include? ( "Sampling Histogram" )
91
+ out . should . include? ( "Kernel#loop" )
76
92
end
77
93
end
78
94
end
You can’t perform that action at this time.
0 commit comments