Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Include types of values in assertion failures #178

Open
Labels
feature-requestAny request for a new feature of the language. Includes both syntax and library features. stdlibAny issue relating to the standard library (Myst code) of Myst.

Description

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestAny request for a new feature of the language. Includes both syntax and library features. stdlibAny issue relating to the standard library (Myst code) of Myst.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /