Skip to content

Commit 155eae1

Browse files
authored
Merge pull request #321 from rock-core/code_error_any
fix: initialize CodeErrorMatcher to match any exception *or* no exceptions at all
2 parents fd227fa + bf865f7 commit 155eae1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/roby/queries/code_error_matcher.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CodeErrorMatcher < LocalizedErrorMatcher
1111

1212
def initialize
1313
super
14-
@ruby_exception_class = ::Exception
14+
@ruby_exception_class = Any
1515
with_model(CodeError)
1616
end
1717

test/queries/test_code_error_matcher.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ module Queries
99
plan.add(@task = Roby::Task.new)
1010
end
1111

12-
it "matches a plain CodeError object as-is" do
12+
it "matches a plain CodeError with exception as-is" do
1313
error = CodeError.new(Exception.new, @task)
1414
matcher = CodeErrorMatcher.new
1515
assert_operator matcher, :===, error
1616
end
1717

18+
it "matches a plain CodeError without exception as-is" do
19+
error = CodeError.new(nil, @task)
20+
matcher = CodeErrorMatcher.new
21+
assert_operator matcher, :===, error
22+
end
23+
1824
it "matches a CodeError whose ruby error matches" do
1925
error_m = Class.new(StandardError)
2026
error = CodeError.new(error_m.new, @task)

0 commit comments

Comments
 (0)