mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Ensure languages are sorted
This commit is contained in:
@@ -139,6 +139,13 @@ C-ObjDump:
|
||||
extensions:
|
||||
- .c-objdump
|
||||
|
||||
CMake:
|
||||
extensions:
|
||||
- .cmake
|
||||
- .cmake.in
|
||||
filenames:
|
||||
- CMakeLists.txt
|
||||
|
||||
CSS:
|
||||
extensions:
|
||||
- .css
|
||||
@@ -154,13 +161,6 @@ Clojure:
|
||||
- .clj
|
||||
- .cljs
|
||||
|
||||
CMake:
|
||||
extensions:
|
||||
- .cmake
|
||||
- .cmake.in
|
||||
filenames:
|
||||
- CMakeLists.txt
|
||||
|
||||
CoffeeScript:
|
||||
type: programming
|
||||
extensions:
|
||||
|
||||
29
test/test_pedantic.rb
Normal file
29
test/test_pedantic.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
require 'test/unit'
|
||||
|
||||
class TestPedantic < Test::Unit::TestCase
|
||||
Lib = File.expand_path("../../lib/linguist", __FILE__)
|
||||
|
||||
def file(name)
|
||||
File.read(File.join(Lib, name))
|
||||
end
|
||||
|
||||
def test_language_names_are_sorted
|
||||
languages = []
|
||||
file("languages.yml").lines.each do |line|
|
||||
if line =~ /^(\w+):$/
|
||||
languages << $1
|
||||
end
|
||||
end
|
||||
assert_sorted languages
|
||||
end
|
||||
|
||||
def assert_sorted(list)
|
||||
previous = nil
|
||||
list.each do |item|
|
||||
if previous && previous > item
|
||||
flunk "#{previous} should come after #{item}"
|
||||
end
|
||||
previous = item
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user