refine assertions
* test/irb/test_ruby-lex.rb (test_prompt): invert confinue flag by FIXME comments. adjust line numbers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7c7133b718
commit
9b0118a84c
@ -52,18 +52,18 @@ module TestIRB
|
|||||||
prompts << a
|
prompts << a
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
src = "#{<<-"begin;"}#{<<~'end;'}"
|
src, lineno = "#{<<-"begin;"}#{<<~'end;'}", __LINE__+1
|
||||||
begin;
|
begin;
|
||||||
# #;# LTYPE:INDENT:CONTINUE
|
# #;# LTYPE:INDENT:CONTINUE
|
||||||
x #;# -:0:* # FIXME: a comment should not `continue'
|
x #;# -:0:- # FIXME: a comment should not `continue'
|
||||||
x( #;# -:0:-
|
x( #;# -:0:-
|
||||||
) #;# -:1:*
|
) #;# -:1:*
|
||||||
a \ #;# -:0:-
|
a \ #;# -:0:-
|
||||||
#;# -:0:*
|
#;# -:0:*
|
||||||
a; #;# -:0:-
|
a; #;# -:0:-
|
||||||
a #;# -:0:* # FIXME: a semicolon should not `continue'
|
a #;# -:0:- # FIXME: a semicolon should not `continue'
|
||||||
#;# -:0:-
|
#;# -:0:-
|
||||||
a #;# -:0:* # FIXME: an empty line should not `continue'
|
a #;# -:0:- # FIXME: an empty line should not `continue'
|
||||||
a = #;# -:0:-
|
a = #;# -:0:-
|
||||||
' #;# -:0:*
|
' #;# -:0:*
|
||||||
' #;# ':0:*
|
' #;# ':0:*
|
||||||
@ -73,18 +73,20 @@ module TestIRB
|
|||||||
" #;# -:1:-
|
" #;# -:1:-
|
||||||
" #;# ":1:-
|
" #;# ":1:-
|
||||||
begin #;# -: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:-
|
a #;# -:2:-
|
||||||
end #;# -:2:-
|
end #;# -:2:-
|
||||||
else #;# -:1:-
|
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 #;# -:1:-
|
||||||
end;
|
end;
|
||||||
top_level_statement(src.gsub(/[ \t]*#;#.*/, ''))
|
top_level_statement(src.gsub(/[ \t]*#;#.*/, ''))
|
||||||
src.each_line.with_index(1) do |line, i|
|
src.each_line.with_index(1) do |line, i|
|
||||||
p = prompts.shift
|
p = prompts.shift
|
||||||
next unless /#;#\s*(?:-|(\S)):(\d+):(?:(\*)|-)/ =~ line
|
next unless /#;#\s*(?:-|(?<ltype>\S)):(?<indent>\d+):(?:(?<cont>\*)|-)(?:.*FIXME:(?<fixme>.*))?/ =~ line
|
||||||
assert_equal([$1, $2.to_i, true&$3, i], p[0..3], "#{i}:#{p[4]}: #{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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user