improve messages for test failures
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
27b1553b2f
commit
51196cf518
@ -9,13 +9,15 @@ class BreakTest
|
|||||||
def initialize (filename, line_number, data, comment='')
|
def initialize (filename, line_number, data, comment='')
|
||||||
@filename = filename
|
@filename = filename
|
||||||
@line_number = line_number
|
@line_number = line_number
|
||||||
@comment = comment
|
@comment = comment.gsub(/\s+/, ' ').strip
|
||||||
if filename=='emoji-test'
|
if filename=='emoji-test'
|
||||||
codes, @type = data.split(/\s*;\s*/)
|
codes, @type = data.split(/\s*;\s*/)
|
||||||
@shortname = ''
|
@shortname = ''
|
||||||
else
|
else
|
||||||
codes, @type, @shortname = data.split(/\s*;\s*/)
|
codes, @type, @shortname = data.split(/\s*;\s*/)
|
||||||
end
|
end
|
||||||
|
@type = @type.gsub(/\s+/, ' ').strip
|
||||||
|
@shortname = @shortname.gsub(/\s+/, ' ').strip
|
||||||
@string = codes.split(/\s+/)
|
@string = codes.split(/\s+/)
|
||||||
.map do |ch|
|
.map do |ch|
|
||||||
c = ch.to_i(16)
|
c = ch.to_i(16)
|
||||||
@ -82,8 +84,8 @@ TestEmojiBreaks.data_files_available? and class TestEmojiBreaks
|
|||||||
expected = [test.string]
|
expected = [test.string]
|
||||||
actual = test.string.each_grapheme_cluster.to_a
|
actual = test.string.each_grapheme_cluster.to_a
|
||||||
assert_equal expected, actual,
|
assert_equal expected, actual,
|
||||||
"file: #{test.filename}, line #{test.line_number}, expected '#{expected}', " +
|
"file: #{test.filename}, line #{test.line_number}, " +
|
||||||
"but got '#{actual}', type: #{test.type}, shortname: #{test.shortname}, comment: #{test.comment}"
|
"type: #{test.type}, shortname: #{test.shortname}, comment: #{test.comment}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -92,8 +94,8 @@ TestEmojiBreaks.data_files_available? and class TestEmojiBreaks
|
|||||||
expected = ["A", test.string, "Z"]
|
expected = ["A", test.string, "Z"]
|
||||||
actual = "A#{test.string}Z".each_grapheme_cluster.to_a
|
actual = "A#{test.string}Z".each_grapheme_cluster.to_a
|
||||||
assert_equal expected, actual,
|
assert_equal expected, actual,
|
||||||
"file: #{test.filename}, line #{test.line_number}, expected '#{expected}', " +
|
"file: #{test.filename}, line #{test.line_number}, " +
|
||||||
"but got '#{actual}', type: #{test.type}, shortname: #{test.shortname}, comment: #{test.comment}"
|
"type: #{test.type}, shortname: #{test.shortname}, comment: #{test.comment}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -109,8 +111,10 @@ TestEmojiBreaks.data_files_available? and class TestEmojiBreaks
|
|||||||
expected = [test1.string, test2.string]
|
expected = [test1.string, test2.string]
|
||||||
actual = (test1.string+test2.string).each_grapheme_cluster.to_a
|
actual = (test1.string+test2.string).each_grapheme_cluster.to_a
|
||||||
assert_equal expected, actual,
|
assert_equal expected, actual,
|
||||||
"file: #{test1.filename}, line #{test1.line_number}, expected '#{expected}', " +
|
"file1: #{test1.filename}, line1 #{test1.line_number}, " +
|
||||||
"but got '#{actual}', type: #{test1.type}, shortname: #{test1.shortname}, comment: #{test1.comment}"
|
"file2: #{test2.filename}, line2 #{test2.line_number},\n" +
|
||||||
|
"type1: #{test1.type}, shortname1: #{test1.shortname}, comment1: #{test1.comment},\n" +
|
||||||
|
"type2: #{test2.type}, shortname2: #{test2.shortname}, comment2: #{test2.comment}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user