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

[Fix bug] modify assert_line_text method to be able to make correct assertions #71

Merged
merged 1 commit into from
Jun 8, 2021

Conversation

ono-max
Copy link
Collaborator

@ono-max ono-max commented Jun 8, 2021

No description provided.

line.include? expected
result = false
@internal_info['backlog'].each do |line|
if line.include? expected
Copy link
Member

Choose a reason for hiding this comment

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

can you use match? instead of include? so it can also take regexp as expectation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ono-max ono-max force-pushed the hotfix/modify-assert-line-text-method branch from 1b99dd2 to e97c30b Compare June 8, 2021 01:36
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

thanks 👍

end
end
assert_true(result)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should show failure message. When the test fails, there is no hints and it is difficult to debug.

Copy link
Collaborator Author

@ono-max ono-max Jun 8, 2021

Choose a reason for hiding this comment

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

Thanks, I will add it.

@ono-max ono-max force-pushed the hotfix/modify-assert-line-text-method branch from e97c30b to d747c12 Compare June 8, 2021 02:03
@ono-max ono-max requested a review from ko1 June 8, 2021 02:04
@ono-max ono-max force-pushed the hotfix/modify-assert-line-text-method branch from d747c12 to d4fe7ba Compare June 8, 2021 03:51
assert_block do
@internal_info['backlog'].each do |line|
line.include? expected
msg = "Expected to include #{expected}}"
Copy link
Member

Choose a reason for hiding this comment

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

it still doesn't provide much information:

  Expected to include => 20}.
  <true> expected but was
  <false>

how about this?

assert_match(expected, @internal_info['backlog'].join)
  </=>\ 20/> was expected to be =~
  <"=>#0\tFoo#first_call at /var/folders/yg/hnbymwxd5pn7v94_clc59y6r0000gn/T/debugger20210608-65153-b857w.rb:4 #=> 30\n" +
  "  #1\t<main> at /var/folders/yg/hnbymwxd5pn7v94_clc59y6r0000gn/T/debugger20210608-65153-b857w.rb:23\n">.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good idea! Thanks 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ono-max ono-max force-pushed the hotfix/modify-assert-line-text-method branch from d4fe7ba to 518ba5b Compare June 8, 2021 04:49
@st0012
Copy link
Member

st0012 commented Jun 8, 2021

btw it'd be great if we can merge this sooner than later because the current matcher doesn't take regexp object and never fails when passing string 😬

@ko1 ko1 merged commit dbad15f into ruby:master Jun 8, 2021
@ono-max ono-max deleted the hotfix/modify-assert-line-text-method branch June 8, 2021 06:55
@st0012
Copy link
Member

st0012 commented Jun 8, 2021

@ono-max @ko1 thanks 😄

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