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

Improve test framework #129

merged 4 commits into from
Jul 6, 2021

Conversation

ono-max
Copy link
Collaborator

@ono-max ono-max commented Jul 5, 2021

Currently, check_line_num method will be executed after the test finished. The line numbers should be checked first because test/assertion_helper_test.rb and test/test_utils_test.rb will exit before check_line_num method is executed. This PR will fix it.

I also changed constant variable(DEBUG_MODE) to ENV variable(ENV["RUBY_DEBUG_TEST_DEBUG_MODE"]).

@@ -29,8 +31,6 @@ 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
Copy link
Member

Choose a reason for hiding this comment

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

I'd love to see it become a env var so I can always enable it locally. wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@st0012
Could you explain me more? I just moved check_line_num up. It is always enable, right?

Copy link
Member

Choose a reason for hiding this comment

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

I mean can we make this:

DEBUG_MODE = ENV["RUBY_DEBUG_TEST_DEBUG_MODE"]

so I don't need to change the code to enabled it. like what you did and forgot to change it back (I've done this a lot too 😂 ).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, ok. I thought you were talking about check_line_num. I'll change DEBUG_MODE, too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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.

@ono-max ono-max force-pushed the improve-test-framework branch 2 times, most recently from 0ebafe7 to fd560c5 Compare July 5, 2021 12:01
ASK_CMD = %w[quit delete kill undisplay]

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

Choose a reason for hiding this comment

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

thanks 👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

if ENV['RUBY_DEBUG_TEST_DEBUG_MODE'] ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ko1 ko1 merged commit fcab8b2 into ruby:master Jul 6, 2021
@ono-max ono-max deleted the improve-test-framework branch July 9, 2021 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants