-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In Julia 0.7+ exceptions thrown from macros get wrapped in a LoadError, so we need a macro to unwrap the actual exception.
- Loading branch information
Showing
6 changed files
with
41 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Like @test_throws, but for macros. | ||
# Julia-0.7 and later always wrap the exception in a LoadError. | ||
|
||
@static if VERSION >= v"0.7.0-alpha.0" | ||
macro test_macro_throws(typ, expr) | ||
quote | ||
@test_throws $typ begin | ||
try | ||
$expr | ||
catch e | ||
rethrow(e.error) | ||
end | ||
end | ||
end | ||
end | ||
else | ||
macro test_macro_throws(typ, expr) | ||
quote | ||
@test_throws $typ $expr | ||
end | ||
end | ||
end | ||
|