forked from ruby/debug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_case_test.rb
More file actions
79 lines (69 loc) · 1.91 KB
/
Copy pathtest_case_test.rb
File metadata and controls
79 lines (69 loc) · 1.91 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# frozen_string_literal: true
require_relative 'console_test_case'
module DEBUGGER__
class PseudoTerminalTest < ConsoleTestCase
def program
<<~RUBY
a = 1
RUBY
end
def test_the_test_fails_when_debugger_exits_early
assert_raise_message(/Expected all commands\/assertions to be executed/) do
debug_code(program) do
type 'continue'
type 'foo'
end
end
end
def test_the_test_fails_when_the_script_doesnt_have_line_numbers
assert_raise_message(/line numbers are required in test script. please update the script with:\n/) do
debug_code(program, remote: false) do
type 'continue'
end
end
end
def test_the_test_work_when_debuggee_outputs_many_lines
debug_code ' 1| 300.times{|i| p i}' do
type 'c'
end
end
def test_the_test_fails_when_the_repl_prompt_does_not_finish_even_though_scenario_is_empty
assert_raise_message(/Expected the REPL prompt to finish/) do
debug_code(program) do
end
end
end
end
class PseudoTerminalTestForRemoteDebuggee < ConsoleTestCase
def program
<<~RUBY
1| def a
2| end
3|
4| loop{
5| a()
6| }
RUBY
end
def steps
Proc.new{
type 'quit'
type 'y'
}
end
def test_the_test_fails_when_debuggee_on_unix_domain_socket_mode_doesnt_exist_after_scenarios
assert_raise_message(/Expected the remote program to finish/) do
prepare_test_environment(program, steps) do
debug_code_on_unix_domain_socket()
end
end
end
def test_the_test_fails_when_debuggee_on_tcpip_mode_doesnt_exist_after_scenarios
assert_raise_message(/Expected the remote program to finish/) do
prepare_test_environment(program, steps) do
debug_code_on_tcpip()
end
end
end
end
end