ruby-changes:45388
From: nobu <ko1@a...>
Date: Mon, 30 Jan 2017 13:47:47 +0900 (JST)
Subject: [ruby-changes:45388] nobu:r57461 (trunk): refine assertions
nobu 2017-01-30 13:47:44 +0900 (Mon, 30 Jan 2017) New Revision: 57461 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57461 Log: refine assertions * test/irb/test_ruby-lex.rb (test_prompt): invert confinue flag by FIXME comments. adjust line numbers. Modified files: trunk/test/irb/test_ruby-lex.rb Index: test/irb/test_ruby-lex.rb =================================================================== --- test/irb/test_ruby-lex.rb (revision 57460) +++ test/irb/test_ruby-lex.rb (revision 57461) @@ -52,18 +52,18 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_ruby-lex.rb#L52 prompts << a end } - src = "#{<<-"begin;"}#{<<~'end;'}" + src, lineno = "#{<<-"begin;"}#{<<~'end;'}", __LINE__+1 begin; # #;# LTYPE:INDENT:CONTINUE - x #;# -:0:* # FIXME: a comment should not `continue' + x #;# -:0:- # FIXME: a comment should not `continue' x( #;# -:0:- ) #;# -:1:* a \ #;# -:0:- #;# -:0:* a; #;# -:0:- - a #;# -:0:* # FIXME: a semicolon should not `continue' + a #;# -:0:- # FIXME: a semicolon should not `continue' #;# -:0:- - a #;# -:0:* # FIXME: an empty line should not `continue' + a #;# -:0:- # FIXME: an empty line should not `continue' a = #;# -:0:- ' #;# -:0:* ' #;# ':0:* @@ -73,18 +73,20 @@ module TestIRB https://github.com/ruby/ruby/blob/trunk/test/irb/test_ruby-lex.rb#L73 " #;# -:1:- " #;# ":1:- begin #;# -:1:- - a #;# -:2:* # FIXME: the first line should not be `continue'd + a #;# -:2:- # FIXME: the first line should not be `continue'd a #;# -:2:- end #;# -:2:- else #;# -:1:- - nil #;# -:1:* # FIXME: just after `else' should not be `continue'd + nil #;# -:1:- # FIXME: just after `else' should not be `continue'd end #;# -:1:- end; top_level_statement(src.gsub(/[ \t]*#;#.*/, '')) src.each_line.with_index(1) do |line, i| p = prompts.shift - next unless /#;#\s*(?:-|(\S)):(\d+):(?:(\*)|-)/ =~ line - assert_equal([$1, $2.to_i, true&$3, i], p[0..3], "#{i}:#{p[4]}: #{line}") + next unless /#;#\s*(?:-|(?<ltype>\S)):(?<indent>\d+):(?:(?<cont>\*)|-)(?:.*FIXME:(?<fixme>.*))?/ =~ line + indent = indent.to_i + cont = (fixme && /`continue'/.match?(fixme)) ^ cont + assert_equal([ltype, indent, cont, i], p[0..3], "#{lineno+i}:#{p[4]}: #{line}") end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/