JoshCheek / seeing_is_believing

Displays the results of every line of code in your file
1.31k stars 54 forks source link

Wraps whole body incorrectly on multi-line bodies with expressions not at the end #35

Closed JoshCheek closed 10 years ago

JoshCheek commented 10 years ago

Looks like when you have an expression with an implicit begin/end wrapped around them, and the last expression is not on the last line, then it incorrectly identifies where the body is and wraps the wrong thing:

a
def b
  c = 1
end

Wraps like this (rescue comes after the line in m, rather than the final end):

begin; $SiB.number_of_captures = Float::INFINITY; $SiB.record_result(1, (a))
def b
  $SiB.record_result(3, (c = 1));rescue Exception;line_number = $!.backtrace.grep(/#{__FILE__}/).first[/:\d+/][1..-1].to_i;$SiB.record_exception line_number, $!;$SiB.exitstatus = 1;$SiB.exitstatus = $!.status if $!.kind_of? SystemExit;end
end