Skip to content

Commit

Permalink
Improved implementation of ExecutionPoint in order to get better test…
Browse files Browse the repository at this point in the history
… error messages when no backtrace is supplied or an empty backtrace is supplied.
  • Loading branch information
floehopper committed May 5, 2008
1 parent 689b0f9 commit f84647c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/execution_point.rb
Expand Up @@ -11,10 +11,12 @@ def initialize(backtrace)
end

def file_name
return "unknown" unless @backtrace && @backtrace.first
/\A(.*?):\d+/.match(@backtrace.first)[1]
end

def line_number
return "unknown" unless @backtrace && @backtrace.first
Integer(/\A.*?:(\d+)/.match(@backtrace.first)[1])
end

Expand All @@ -24,7 +26,7 @@ def ==(other)
end

def to_s
"file: #{file_name} line: #{line_number}"
"file: #{file_name}; line: #{line_number}"
end

def inspect
Expand Down

0 comments on commit f84647c

Please sign in to comment.