Skip to content

Commit 829d0d3

Browse files
committed
Add test
1 parent 2d64002 commit 829d0d3

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/console/daemon_test.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ def program
1717
end
1818

1919
def test_daemon
20-
# The program can't be debugged locally since the parent process exits when Process.daemon is called.
2120
debug_code program, remote: :remote_only do
2221
type 'b 3'
2322
type 'c'
@@ -28,5 +27,26 @@ def test_daemon
2827
type 'c'
2928
end
3029
end
30+
31+
def program_with_daemon_arguments
32+
<<~'RUBY'
33+
1| trap(:HUP, 'IGNORE')
34+
2| puts 'Daemon starting'
35+
3| Process.daemon(false, false)
36+
4| puts 'Daemon started'
37+
RUBY
38+
end
39+
40+
def test_daemon_patch
41+
debug_code program_with_daemon_arguments, remote: :remote_only do
42+
type 'b 3'
43+
type 'c'
44+
assert_line_num 3
45+
type 'b 4'
46+
type 'c'
47+
assert_line_num 4
48+
type 'c'
49+
end
50+
end
3151
end
3252
end

0 commit comments

Comments
 (0)