blob: 191a7868721e3ec17324ea0c5c3bde8ac998abf2 (
plain)
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
|
# frozen_string_literal: false
require 'irb'
require_relative "../helper"
module TestIRB
class ForceExitTest < IntegrationTestCase
def test_forced_exit_finishes_process_immediately
write_ruby <<~'ruby'
puts "First line"
puts "Second line"
binding.irb
puts "Third line"
binding.irb
puts "Fourth line"
ruby
output = run_ruby_file do
type "123"
type "456"
type "exit!"
end
assert_match(/First line\r\n/, output)
assert_match(/Second line\r\n/, output)
assert_match(/irb\(main\):001> 123/, output)
assert_match(/irb\(main\):002> 456/, output)
refute_match(/Third line\r\n/, output)
refute_match(/Fourth line\r\n/, output)
end
def test_forced_exit_in_nested_sessions
write_ruby <<~'ruby'
def foo
binding.irb
end
binding.irb
binding.irb
ruby
output = run_ruby_file do
type "123"
type "foo"
type "exit!"
end
assert_match(/irb\(main\):001> 123/, output)
end
end
end
|