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

Include types of values in assertion failures #178

Open
faultyserver opened this issue Mar 31, 2018 · 0 comments
Open

Include types of values in assertion failures #178

faultyserver opened this issue Mar 31, 2018 · 0 comments
Labels
feature-request Any request for a new feature of the language. Includes both syntax and library features. stdlib Any issue relating to the standard library (Myst code) of Myst.

Comments

@faultyserver
Copy link
Member

I recently ran into what I thought was a bug when I saw this error from a simple spec:

  String#to_i String#to_i String#to_i defaults to parsing in base 10
    Assertion failed: `left == right`
     left: 1234567890
    right: 1234567890

The spec in question looks like this:

assert("1234567890").equals(1234567890)

I was confused at first because the values look the same in the error output. Looking at the code, it's (somewhat) obvious that the failure comes from the fact that the types of the values do not match, even though the string representation of the values do (one's a String, the other's an Integer).

To mitigate this, I'd like to see the type of the value added to the assertion failure output. With that, I would expect it to look something like:

  String#to_i String#to_i String#to_i defaults to parsing in base 10
    Assertion failed: `left == right`
     left: 1234567890 (String)
    right: 1234567890 (Integer)
@faultyserver faultyserver added stdlib Any issue relating to the standard library (Myst code) of Myst. feature-request Any request for a new feature of the language. Includes both syntax and library features. labels Mar 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Any request for a new feature of the language. Includes both syntax and library features. stdlib Any issue relating to the standard library (Myst code) of Myst.
Projects
None yet
Development

No branches or pull requests

1 participant