-
-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for exotic rescued error capturing
The idiomatic way to capture exceptions is to assign to a local variable rescue => local_variable However, other kinds of LVALUEs also work rescue => $global_variable rescue => @@class_variable rescue => @instance_variable rescue => Constant rescue => receiver&.setter_method rescue => receiver.setter_method rescue => receiver[:key] Some of the tests involve side effects to the global state. We can remove the constant and class variable, but the best we can go for the global variable is to nil it out. This is effectively identical to removing it though, as nil is the default when accessing an undefined global.
- Loading branch information
1 parent
440fea7
commit 99e141f
Showing
2 changed files
with
120 additions
and
5 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