forked from crystal-lang/crystal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'unreachable!' method to express unreachable code explicitly
This is an implementation of crystal-lang#4749.
- Loading branch information
1 parent
d23db08
commit a9b6e56
Showing
3 changed files
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require "spec" | ||
|
||
describe "unreachable!" do | ||
it "raises UnreachableError with 'BUG: unreachable' message" do | ||
expect_raises(UnreachableError, "BUG: unreachable") { unreachable! } | ||
end | ||
|
||
it "can set an error message" do | ||
expect_raises UnreachableError, "BUG: i'm bag" do | ||
unreachable! "i'm bag" | ||
end | ||
end | ||
end |
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