dietrb 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/dietrb.gemspec +1 -1
- data/lib/irb/context.rb +5 -0
- data/lib/irb/version.rb +1 -1
- data/spec/context_spec.rb +7 -0
- metadata +1 -1
data/dietrb.gemspec
CHANGED
data/lib/irb/context.rb
CHANGED
@@ -48,6 +48,7 @@ module IRB
|
|
48
48
|
puts formatter.result(result)
|
49
49
|
result
|
50
50
|
rescue Exception => e
|
51
|
+
store_exception(e)
|
51
52
|
puts formatter.exception(e)
|
52
53
|
end
|
53
54
|
|
@@ -114,6 +115,10 @@ module IRB
|
|
114
115
|
def store_result(result)
|
115
116
|
@underscore_assigner.call(result)
|
116
117
|
end
|
118
|
+
|
119
|
+
def store_exception(exception)
|
120
|
+
$e = $EXCEPTION = exception
|
121
|
+
end
|
117
122
|
end
|
118
123
|
end
|
119
124
|
|
data/lib/irb/version.rb
CHANGED
data/spec/context_spec.rb
CHANGED
@@ -112,6 +112,13 @@ describe "IRB::Context, when evaluating source" do
|
|
112
112
|
}.should.not.raise
|
113
113
|
end
|
114
114
|
|
115
|
+
it "assigns the last raised exception to the global variable `$EXCEPTION' / `$e'" do
|
116
|
+
@context.evaluate("DoesNotExist")
|
117
|
+
$EXCEPTION.should.be.instance_of NameError
|
118
|
+
$EXCEPTION.message.should.include 'DoesNotExist'
|
119
|
+
$e.should == $EXCEPTION
|
120
|
+
end
|
121
|
+
|
115
122
|
it "prints the exception that occurs" do
|
116
123
|
@context.evaluate("DoesNotExist")
|
117
124
|
@context.printed.should.match /^NameError:.+DoesNotExist/
|