Skip to content

Commit cb371de

Browse files
andyw8ko1
authored andcommitted
Use local variables
1 parent e2a8b95 commit cb371de

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

test/console/daemon_test.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,18 @@
44

55
module DEBUGGER__
66
class DaemonTest < ConsoleTestCase
7-
def program
7+
8+
def test_daemon
89
# Ignore SIGHUP since the test debuggee receives SIGHUP after Process.daemon.
910
# When manualy debugging a daemon, it doesn't receive SIGHUP.
1011
# I don't know why.
11-
<<~'RUBY'
12+
program = <<~'RUBY'
1213
1| trap(:HUP, 'IGNORE')
1314
2| puts 'Daemon starting'
1415
3| Process.daemon
1516
4| puts 'Daemon started'
1617
RUBY
17-
end
1818

19-
def test_daemon
2019
# 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'
@@ -29,17 +28,15 @@ def test_daemon
2928
end
3029
end
3130

32-
def program_with_daemon_arguments
33-
<<~'RUBY'
31+
def test_daemon_patch
32+
program = <<~'RUBY'
3433
1| trap(:HUP, 'IGNORE')
3534
2| puts 'Daemon starting'
3635
3| Process.daemon(false, false)
3736
4| puts 'Daemon started'
3837
RUBY
39-
end
4038

41-
def test_daemon_patch
42-
debug_code program_with_daemon_arguments, remote: :remote_only do
39+
debug_code program, remote: :remote_only do
4340
type 'b 3'
4441
type 'c'
4542
assert_line_num 3

0 commit comments

Comments
 (0)