Repository navigation
Expand file tree
/
Copy pathassertions_test.rb
More file actions
78 lines (66 loc) · 2.07 KB
/
Copy pathassertions_test.rb
File metadata and controls
78 lines (66 loc) · 2.07 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
# frozen_string_literal: true
require_relative 'console_test_case'
module DEBUGGER__
class AssertLineTextTest < ConsoleTestCase
def program
<<~RUBY
a = 1
RUBY
end
def test_the_helper_takes_a_string_expectation_and_escape_it
assert_raise_message(/Expected to include `"foobar\\\\?/) do
debug_code(program, remote: false) do
assert_line_text("foobar?")
end
end
end
def test_the_helper_takes_an_array_of_string_expectations_and_combine_them
assert_raise_message(/Expected to include `"foobar\\\\?/) do
debug_code(program, remote: false) do
assert_line_text(["foo", "bar?"])
end
end
end
def test_the_helper_takes_a_regexp_expectation
assert_raise_message(/Expected to include `\/foobar\/`/) do
debug_code(program, remote: false) do
assert_line_text(/foobar/)
end
end
end
def test_the_helper_takes_an_array_of_regexp_expectations_and_combine_them
assert_raise_message(/Expected to include `\/foo\.\*bar\/m`/) do
debug_code(program, remote: false) do
assert_line_text([/foo/, /bar/])
end
end
end
def test_the_helper_raises_an_error_with_invalid_expectation
assert_raise_message(/Unknown expectation value: 123/) do
debug_code(program, remote: false) do
assert_line_text(123)
end
end
end
def test_the_test_fails_when_debuggee_on_unix_domain_socket_mode_doesnt_exist_after_scenarios
assert_raise_message(/Expected to include `"foobar\\\\?/) 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 to include `"foobar\\\\?/) do
prepare_test_environment(program, steps) do
debug_code_on_tcpip()
end
end
end
private
def steps
Proc.new{
assert_line_text("foobar?")
}
end
end
end