Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test framework #129

Merged
merged 4 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/assertion_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module DEBUGGER__
class AssertLineTextTest < TestCase
def program
<<~RUBY
a = 1
1| a = 1
RUBY
end

Expand Down
2 changes: 1 addition & 1 deletion test/support/test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def teardown
end

def remove_temp_file
File.unlink(@temp_file)
File.unlink(@temp_file) if @temp_file
@temp_file = nil
end

Expand Down
7 changes: 3 additions & 4 deletions test/support/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def create_message fail_msg

# This method will execute both local and remote mode by default.
def debug_code(program, boot_options: '-r debug/run', remote: true, &block)
check_line_num!(program)

@scenario = block
write_temp_file(strip_line_num(program))
inject_lib_to_load_path
Expand All @@ -29,15 +31,12 @@ def debug_code(program, boot_options: '-r debug/run', remote: true, &block)
debug_on_unix_domain_socket
debug_on_tcpip
end

check_line_num!(program)
end

DEBUG_MODE = false
ASK_CMD = %w[quit delete kill undisplay]

def debug_print msg
print msg if DEBUG_MODE
print msg if ENV['RUBY_DEBUG_TEST_DEBUG_MODE']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be

print msg if ENV['RUBY_DEBUG_TEST_DEBUG_MODE'] != "false"

because it's a string instead of boolean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That was my mistake.

end

RUBY = RbConfig.ruby
Expand Down
2 changes: 1 addition & 1 deletion test/test_utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module DEBUGGER__
class PseudoTerminalTest < TestCase
def program
<<~RUBY
a = 1
1| a = 1
RUBY
end

Expand Down