Merge branch 'master' into 1348-local

Conflicts:
	lib/linguist/samples.json
This commit is contained in:
Arfon Smith
2014-08-13 15:26:49 -07:00
4 changed files with 65 additions and 3 deletions

View File

@@ -532,6 +532,7 @@ module Linguist
if extnames = extensions[name]
extnames.each do |extname|
if !options['extensions'].include?(extname)
warn "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml" unless extname == '.script!'
options['extensions'] << extname
end
end

View File

@@ -260,6 +260,7 @@ C:
extensions:
- .c
- .cats
- .h
- .w
C#:
@@ -288,6 +289,7 @@ C++:
- .cc
- .cxx
- .H
- .h
- .h++
- .hh
- .hpp
@@ -452,6 +454,7 @@ Coq:
type: programming
extensions:
- .coq
- .v
Cpp-ObjDump:
type: data
@@ -547,6 +550,7 @@ Dart:
Diff:
extensions:
- .diff
- .patch
Dogescript:
type: programming
@@ -631,6 +635,7 @@ Erlang:
color: "#0faf8d"
extensions:
- .erl
- .escript
- .hrl
F#:
@@ -706,6 +711,7 @@ Forth:
extensions:
- .fth
- .4th
- .forth
Frege:
type: programming
@@ -814,6 +820,9 @@ Gosu:
color: "#82937f"
extensions:
- .gs
- .gst
- .gsx
- .vark
Grace:
type: programming
@@ -849,6 +858,7 @@ Groovy:
color: "#e69f56"
extensions:
- .groovy
- .gradle
- .grt
- .gtpl
- .gvy
@@ -953,6 +963,7 @@ IDL:
color: "#e3592c"
extensions:
- .pro
- .dlm
INI:
type: data
@@ -1027,6 +1038,7 @@ JSON:
searchable: false
extensions:
- .json
- .lock
- .sublime-keymap
- .sublime-mousemap
- .sublime-project
@@ -1155,6 +1167,9 @@ Lasso:
color: "#2584c3"
extensions:
- .lasso
- .las
- .lasso9
- .ldml
Latte:
type: markup
@@ -1240,6 +1255,7 @@ Lua:
extensions:
- .lua
- .nse
- .pd_lua
- .rbxs
interpreters:
- lua
@@ -1385,6 +1401,7 @@ Myghty:
NSIS:
extensions:
- .nsi
- .nsh
Nemerle:
type: programming
@@ -1449,6 +1466,7 @@ OCaml:
color: "#3be133"
extensions:
- .ml
- .eliom
- .eliomi
- .ml4
- .mli
@@ -1469,6 +1487,7 @@ Objective-C:
- objc
extensions:
- .m
- .h
Objective-C++:
type: programming
@@ -1516,6 +1535,7 @@ OpenEdge ABL:
- abl
extensions:
- .p
- .cls
Org:
type: prose
@@ -1554,6 +1574,7 @@ PHP:
- .php
- .aw
- .ctp
- .module
- .php3
- .php4
- .php5
@@ -1602,6 +1623,7 @@ Pascal:
extensions:
- .pas
- .dfm
- .dpr
- .lpr
Perl:
@@ -1611,12 +1633,14 @@ Perl:
extensions:
- .pl
- .PL
- .fcgi
- .perl
- .ph
- .plx
- .pm
- .pod
- .psgi
- .t
interpreters:
- perl
@@ -1825,6 +1849,7 @@ Racket:
- .rkt
- .rktd
- .rktl
- .scrbl
Ragel in Ruby Host:
type: programming
@@ -1894,7 +1919,10 @@ Ruby:
- .god
- .irbrc
- .mspec
- .pluginspec
- .podspec
- .rabl
- .rake
- .rbuild
- .rbw
- .rbx
@@ -1968,6 +1996,7 @@ Sass:
group: CSS
extensions:
- .sass
- .scss
Scala:
type: programming
@@ -1975,6 +2004,7 @@ Scala:
color: "#7dd3b0"
extensions:
- .scala
- .sbt
- .sc
Scaml:
@@ -1990,6 +2020,7 @@ Scheme:
- .scm
- .sld
- .sls
- .sps
- .ss
interpreters:
- guile
@@ -2001,6 +2032,8 @@ Scilab:
type: programming
extensions:
- .sci
- .sce
- .tst
Self:
type: programming
@@ -2020,8 +2053,10 @@ Shell:
- zsh
extensions:
- .sh
- .bash
- .bats
- .tmux
- .zsh
interpreters:
- bash
- sh
@@ -2088,6 +2123,7 @@ Standard ML:
extensions:
- .ML
- .fun
- .sig
- .sml
Stata:
@@ -2288,6 +2324,7 @@ Visual Basic:
extensions:
- .vb
- .bas
- .cls
- .frm
- .frx
- .vba
@@ -2316,6 +2353,7 @@ XML:
- wsdl
extensions:
- .xml
- .ant
- .axml
- .ccxml
- .clixml
@@ -2329,6 +2367,7 @@ XML:
- .fsproj
- .glade
- .grxml
- .ivy
- .jelly
- .kml
- .launch

View File

@@ -43,6 +43,10 @@
# Normalize.css
- normalize.css
# Animate.css
- animate.css
- animate.min.css
# Vendored dependencies
- thirdparty/
- vendors?/

View File

@@ -35,15 +35,33 @@ class TestSamples < Test::Unit::TestCase
assert_equal data['tokens_total'], data['language_tokens'].inject(0) { |n, (_, c)| n += c }
assert_equal data['tokens_total'], data['tokens'].inject(0) { |n, (_, ts)| n += ts.inject(0) { |m, (_, c)| m += c } }
end
# Check that there aren't samples with extensions that aren't explicitly defined in languages.yml
def test_parity
extensions = Samples::DATA['extnames']
languages_yml = File.expand_path("../../lib/linguist/languages.yml", __FILE__)
languages = YAML.load_file(languages_yml)
languages.each do |name, options|
options['extensions'] ||= []
if extnames = extensions[name]
extnames.each do |extname|
next if extname == '.script!'
assert options['extensions'].include?(extname), "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml"
end
end
end
end
# If a language extension isn't globally unique then make sure there are samples
def test_presence
Linguist::Language.all.each do |language|
language.all_extensions.each do |extension|
language_matches = Language.find_by_filename("foo#{extension}")
# If there is more than one language match for a given extension
# then check that there are examples for that language with the extension
# then check that there are examples for that language with the extension
if language_matches.length > 1
language_matches.each do |language|
assert File.directory?("samples/#{language.name}"), "#{language.name} is missing a samples directory"