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 issues in Assert.exception(). #129

Merged
merged 4 commits into from
Dec 20, 2023

Conversation

player-03
Copy link
Contributor

@player-03 player-03 commented Dec 20, 2023

Since I already figured out the issues causing CI to fail, I figured I could apply the same solution to the new function. Plus I fixed the documentation, re-organized the code for clarity, and made the failure messages look better.

Edit: but apparently something else changed. I'm working on it. Edit 2: it was target-specific weirdness.

Supersedes #127 and #128.

This allows the IDE to notice it, without being as disruptive as the `@:deprecated` metadata.
This fixes a null pointer error in the tests, moves the `try catch` block to the top of the function for easier readability, reduces the total amount of code, and standardizes the failure messages. (Among other things, it used to print a double space if `type` was null.)
On that target, `Std.isOfType()` will return true as long as `e` is any enum value, making it useless for the intended test.
@RealyUniqueName
Copy link
Member

Thanks! What's the issue with C++?

@player-03
Copy link
Contributor Author

player-03 commented Dec 20, 2023

It seems to implement enums slightly differently, making it unable to tell one enum type from another.

Std.isOfType(Sample.Some('error'), haxe.ds.Option) returns true, and at first that looks like it's because both have a constructor named Some. But then you try other values and they return true as well: Std.isOfType(Sample.Rec(Sample.None), haxe.ds.Either).

So basically, the test can't be performed in C++.

@RealyUniqueName
Copy link
Member

It's an issue of the Haxe itself: HaxeFoundation/haxe#11442

@RealyUniqueName RealyUniqueName merged commit 88bc300 into haxe-utest:master Dec 20, 2023
13 checks passed
@player-03
Copy link
Contributor Author

Agreed.

@player-03 player-03 deleted the exception branch December 20, 2023 19:27
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