Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
45158034
Commit
45158034
authored
12 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for raise monkey patch
parent
a75dd6e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/debrew/raise_plus.rb
+2
-0
2 additions, 0 deletions
Library/Homebrew/debrew/raise_plus.rb
Library/Homebrew/test/test_raise_plus.rb
+45
-0
45 additions, 0 deletions
Library/Homebrew/test/test_raise_plus.rb
with
47 additions
and
0 deletions
Library/Homebrew/debrew/raise_plus.rb
+
2
−
0
View file @
45158034
...
...
@@ -11,6 +11,8 @@ end
module
RaisePlus
alias
:original_raise
:raise
private
def
raise
(
*
args
)
exception
=
case
when
args
.
size
==
0
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/test_raise_plus.rb
0 → 100644
+
45
−
0
View file @
45158034
require
'testing_env'
require
'debrew/raise_plus'
class
RaisePlusTests
<
Test
::
Unit
::
TestCase
include
RaisePlus
def
test_raises_runtime_error_when_no_args
assert_raises
(
RuntimeError
)
{
raise
}
end
def
test_raises_runtime_error_with_string_arg
raise
"foo"
rescue
Exception
=>
e
assert_kind_of
RuntimeError
,
e
assert_equal
"foo"
,
e
.
to_s
end
def
test_raises_given_exception_with_new_to_s
a
=
Exception
.
new
(
"foo"
)
raise
a
,
"bar"
rescue
Exception
=>
e
assert_equal
"bar"
,
e
.
to_s
end
def
test_raises_same_instance
a
=
Exception
.
new
(
"foo"
)
raise
a
rescue
Exception
=>
e
assert_same
e
,
a
end
def
test_raises_exception_class
assert_raises
(
StandardError
)
{
raise
StandardError
}
end
def
test_raises_type_error_for_bad_args
assert_raises
(
TypeError
)
{
raise
1
}
end
def
test_raise_is_private
assert_raises
(
NoMethodError
)
do
Object
.
new
.
extend
(
RaisePlus
).
raise
(
RuntimeError
)
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment