You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Program: "begin;($seeing_is_believing_current_result.record_result(9, (def destroy_message(string)\n($seeing_is_believing_current_result.record_result(2, ( matched_string = string.match(/:/))))\n($seeing_is_believing_current_result.record_result(7, ( if matched_string \n($seeing_is_believing_current_result.record_result(4, ( "#{matched_string.pre_match}#{matched_string}")))\n else\n return "this has no message"\n end)))\n #string[/\A[^:]:/]\nend)))\n\n($seeing_is_believing_current_result.record_result(14, (def destroy_message!(string)\n # matched_string = string.match(/:/)\n($seeing_is_believing_current_result.record_result(13, ( string.sub!(/(?<=:)./,''))))\nend)))\n\n# Driver code... \n($seeing_is_believing_current_result.record_result(17, (string = "this message will self-destruct: you can't hug every cat")))\n($seeing_is_believing_current_result.record_result(18, (original_string = string.dup)))\n($seeing_is_believing_current_result.record_result(19, (puts destroy_message(string) == "this message will self-destruct:")))\nputs string == original_string # we shouldn't modify the string passed to destroy_message\n\n($seeing_is_believing_current_result.record_result(22, (string = "this has no message")))\n($seeing_is_believing_current_result.record_result(23, (original_string = string.dup)))\n($seeing_is_believing_current_result.record_result(24, (puts destroy_message(string) == string)))\nputs string == original_string # we shouldn't modify the string passed to destroy_message\n\n($seeing_is_believing_current_result.record_result(27, (string = "this message will self-destruct: you can't hug every cat")))\n($seeing_is_believing_current_result.record_result(28, (original_string = string.dup)))\n($seeing_is_believing_current_result.record_result(29, (puts destroy_message!(string) == "this message will self-destruct:")))\n($seeing_is_believing_current_result.record_result(30, (puts string == "this message will self-destruct:")))\n($seeing_is_believing_current_result.record_result(31, (puts string != original_string)))\n\n($seeing_is_believing_current_result.record_result(33, (string = "this has no message")))\n($seeing_is_believing_current_result.record_result(34, (result = destroy_message!(string))))\n($seeing_is_believing_current_result.record_result(35, (puts result.nil?)))\n($seeing_is_believing_current_result.record_result(36, (puts string == string)))\n\nrescue Exception;line_number = $!.backtrace.grep(/#{FILE}/).first[/:\d+/][1..-1].to_i;$seeing_is_believing_current_result.record_exception line_number, $!;end"
Code that generated this:
defdestroy_message(string)matched_string=string.match(/:/)# => #<MatchData ":">, nilifmatched_string"#{matched_string.pre_match}#{matched_string}"# => "this message will self-destruct:"elsereturn"this has no message"# => nilend# => "this message will self-destruct:", nil#string[/\A[^:]*:/]end# => nildefdestroy_message!(string)# matched_string = string.match(/:/)string.sub!(/(?<=:).*/,'')# => "this message will self-destruct:", nilend# => nil# Driver code... string="this message will self-destruct: you can't hug every cat"# => "this message will self-destruct: you can't hug every cat"original_string=string.dup# => "this message will self-destruct: you can't hug every cat"putsdestroy_message(string) == "this message will self-destruct:"# => nilputsstring == original_string# we shouldn't modify the string passed to destroy_messagestring="this has no message"# => "this has no message"original_string=string.dup# => "this has no message"putsdestroy_message(string) == string# => nilputsstring == original_string# we shouldn't modify the string passed to destroy_messagestring="this message will self-destruct: you can't hug every cat"# => "this message will self-destruct: you can't hug every cat"original_string=string.dup# => "this message will self-destruct: you can't hug every cat"putsdestroy_message!(string) == "this message will self-destruct:"# => nilputsstring == "this message will self-destruct:"# => nilputsstring != original_string# => nilstring="this has no message"# => "this has no message"result=destroy_message!(string)# => nilputsresult.nil?# => nilputsstring == string# => nil# >> true# >> true# >> This has no message# >> false# >> true# >> true# >> true# >> true# >> true# >> true
The text was updated successfully, but these errors were encountered:
It blows up b/c of a void value expression. E.g. same reason this blows up when run in normal Ruby:
1.timesdoputs(iftruebreakend)end
I don't know how to fix this without either making the regex super duper overly hyper conservative, or actually parsing Ruby for real. I'd prefer the latter, but it's beyond me at the moment, so this probably won't be fixed for a while :(
Should be fixed with 259a6f9 I'll close this once I understand @whitequark's comment so that I can feel confident this hits all the cases of void value expressions.
It blew up because SeeingIsBelieving isn't good enough >.<
Please log an issue at: https://github.com/JoshCheek/seeing_is_believing/issues
Program: "begin;($seeing_is_believing_current_result.record_result(9, (def destroy_message(string)\n($seeing_is_believing_current_result.record_result(2, ( matched_string = string.match(/:/))))\n($seeing_is_believing_current_result.record_result(7, ( if matched_string \n($seeing_is_believing_current_result.record_result(4, ( "#{matched_string.pre_match}#{matched_string}")))\n else\n return "this has no message"\n end)))\n #string[/\A[^:]:/]\nend)))\n\n($seeing_is_believing_current_result.record_result(14, (def destroy_message!(string)\n # matched_string = string.match(/:/)\n($seeing_is_believing_current_result.record_result(13, ( string.sub!(/(?<=:)./,''))))\nend)))\n\n# Driver code... \n($seeing_is_believing_current_result.record_result(17, (string = "this message will self-destruct: you can't hug every cat")))\n($seeing_is_believing_current_result.record_result(18, (original_string = string.dup)))\n($seeing_is_believing_current_result.record_result(19, (puts destroy_message(string) == "this message will self-destruct:")))\nputs string == original_string # we shouldn't modify the string passed to destroy_message\n\n($seeing_is_believing_current_result.record_result(22, (string = "this has no message")))\n($seeing_is_believing_current_result.record_result(23, (original_string = string.dup)))\n($seeing_is_believing_current_result.record_result(24, (puts destroy_message(string) == string)))\nputs string == original_string # we shouldn't modify the string passed to destroy_message\n\n($seeing_is_believing_current_result.record_result(27, (string = "this message will self-destruct: you can't hug every cat")))\n($seeing_is_believing_current_result.record_result(28, (original_string = string.dup)))\n($seeing_is_believing_current_result.record_result(29, (puts destroy_message!(string) == "this message will self-destruct:")))\n($seeing_is_believing_current_result.record_result(30, (puts string == "this message will self-destruct:")))\n($seeing_is_believing_current_result.record_result(31, (puts string != original_string)))\n\n($seeing_is_believing_current_result.record_result(33, (string = "this has no message")))\n($seeing_is_believing_current_result.record_result(34, (result = destroy_message!(string))))\n($seeing_is_believing_current_result.record_result(35, (puts result.nil?)))\n($seeing_is_believing_current_result.record_result(36, (puts string == string)))\n\nrescue Exception;line_number = $ !.backtrace.grep(/#{FILE}/).first[/:\d+/][1..-1].to_i;$seeing_is_believing_current_result.record_exception line_number, $!;end"
Code that generated this:
The text was updated successfully, but these errors were encountered: