Skip to content

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jun 9, 2022

So the tests won't fail because of changes like ruby/ruby#4857

@st0012 st0012 changed the title Make tests Exception#inspect independent Make tests Exception#inspect independent Jun 9, 2022
type "catch Exception"
type "c"
type "_raised"
assert_line_text(/#<NameError: undefined local variable or method `foo' for main:Object/)
Copy link
Member Author

Choose a reason for hiding this comment

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

Note that the exception here is printed with #inspect because that's how debugger prints objects from console (pp + width limit). So it's not produced by the test framework.

@st0012
Copy link
Member Author

st0012 commented Jun 9, 2022

cc @mame

@st0012 st0012 force-pushed the improve-test-framework-error-handling branch 2 times, most recently from 2a72724 to c870d26 Compare June 13, 2022 23:12
st0012 added 2 commits July 5, 2022 10:36
Main reason: if ruby/ruby#4857 is implemented,
using `#inspect` will lose the newlines from the formatted message.

Another reason: test frameworks usually fetch exceptions' class name
and message separately to compose the full message, instead of just
calling `#inspect`. So our test framework should be implemented
similarly.
This will avoid tests from failing because of format changes like
ruby/ruby#4857
@st0012 st0012 force-pushed the improve-test-framework-error-handling branch from c870d26 to 3896db0 Compare July 5, 2022 09:36
@ko1 ko1 merged commit 2db8846 into ruby:master Jul 5, 2022
@st0012 st0012 deleted the improve-test-framework-error-handling branch July 5, 2022 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants