Skip to content

Commit

Permalink
Test that languages have a type
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Feb 22, 2015
1 parent ad9a2d2 commit 8420e4b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_language.rb
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,15 @@ def test_all_languages_have_grammars
assert missing.empty?, message
end

def test_all_languages_have_type
missing = Language.all.select { |language| language.type.nil? }
message = "The following languages' types are not listed in grammars.yml. Please add types for all new languages.\n"

width = missing.map { |language| language.name.length }.max
message << missing.map { |language| sprintf("%-#{width}s %s", language.name, language.tm_scope) }.sort.join("\n")
assert missing.empty?, message
end

def test_all_languages_have_a_valid_ace_mode
ace_fixture_path = File.join('test', 'fixtures', 'ace_modes.json')
skip("No ace_modes.json file") unless File.exist?(ace_fixture_path)
Expand Down

0 comments on commit 8420e4b

Please sign in to comment.