From 8420e4b04467a3e85139bbcb07721c593ea4a3f8 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 22 Feb 2015 10:23:48 -0800 Subject: [PATCH] Test that languages have a type --- test/test_language.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_language.rb b/test/test_language.rb index 1a39744e0d..e12b16b800 100644 --- a/test/test_language.rb +++ b/test/test_language.rb @@ -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)