mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Improve error output
This commit is contained in:
@@ -6,14 +6,11 @@ class TestColorThreshold < Minitest::Test
|
|||||||
def test_color_threshold
|
def test_color_threshold
|
||||||
langs_with_colors = Language.all.reject { |language| language.color.nil? }
|
langs_with_colors = Language.all.reject { |language| language.color.nil? }
|
||||||
cp = ColorProximity.new(10, langs_with_colors.map(&:color))
|
cp = ColorProximity.new(10, langs_with_colors.map(&:color))
|
||||||
failing_threshold = []
|
failing_threshold = langs_with_colors.map do |lang|
|
||||||
langs_with_colors.each do |lang|
|
|
||||||
state = cp.within_threshold?(lang.color[1..-1])
|
state = cp.within_threshold?(lang.color[1..-1])
|
||||||
unless state.first
|
"- #{lang} (#{lang.color}) is close to #{state.last}" unless state.first
|
||||||
failing_threshold << [lang, state.last]
|
end.compact
|
||||||
end
|
message = "The following languages have failing color thresholds. Please modify the hex color.\n#{failing_threshold.join("\n")}"
|
||||||
end
|
|
||||||
message = "The following languages have failing color thresholds. Please modify the hex color.\n#{failing_threshold}"
|
|
||||||
|
|
||||||
assert failing_threshold.empty?, message
|
assert failing_threshold.empty?, message
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user