Skip to content

assertRaise function doesn't do what it intends to? #1

@frou

Description

@frou

Hi there - Thanks for releasing this library.

I was just taking a look at it and noticed that the assertRaise function doesn't seem to do what it intends to.

https://github.com/cacilhas/UnitTestML/blob/master/unittest.sml#L14-L19

That function has a parameter called exc, presumably intended to be a "specimen" of the specific exception that is expected to be raised, e.g. here is a usage:

https://github.com/cacilhas/UnitTestML/blob/master/tests/specs.sml#L29

But the exc function parameter doesn't actually get used at all. Because where the code does handle exc => ..., that doesn't compare the raised exception with the function parameter exc, but rather simply binds the raised exception to the identifier exc (and so shadows the function parameter).

So basically the assertRaise function looks like it is testing whether a specific exception is raised, but at the moment it actually just tests whether any exception was raised.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions