mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge pull request #2153 from github/enforce-type
Test that languages have a type
This commit is contained in:
@@ -271,6 +271,7 @@ Batchfile:
|
||||
ace_mode: batchfile
|
||||
|
||||
Befunge:
|
||||
type: programming
|
||||
extensions:
|
||||
- .befunge
|
||||
ace_mode: text
|
||||
@@ -326,6 +327,7 @@ Boo:
|
||||
ace_mode: text
|
||||
|
||||
Brainfuck:
|
||||
type: programming
|
||||
extensions:
|
||||
- .b
|
||||
- .bf
|
||||
@@ -421,6 +423,7 @@ CLIPS:
|
||||
ace_mode: text
|
||||
|
||||
CMake:
|
||||
type: programming
|
||||
extensions:
|
||||
- .cmake
|
||||
- .cmake.in
|
||||
@@ -480,6 +483,7 @@ Chapel:
|
||||
ace_mode: text
|
||||
|
||||
ChucK:
|
||||
type: programming
|
||||
extensions:
|
||||
- .ck
|
||||
tm_scope: source.java
|
||||
@@ -641,6 +645,7 @@ Crystal:
|
||||
- crystal
|
||||
|
||||
Cucumber:
|
||||
type: programming
|
||||
extensions:
|
||||
- .feature
|
||||
tm_scope: text.gherkin.feature
|
||||
@@ -700,6 +705,7 @@ DM:
|
||||
ace_mode: c_cpp
|
||||
|
||||
Darcs Patch:
|
||||
type: programming
|
||||
search_term: dpatch
|
||||
aliases:
|
||||
- dpatch
|
||||
@@ -717,6 +723,7 @@ Dart:
|
||||
ace_mode: dart
|
||||
|
||||
Diff:
|
||||
type: programming
|
||||
extensions:
|
||||
- .diff
|
||||
- .patch
|
||||
@@ -1014,6 +1021,7 @@ Game Maker Language:
|
||||
ace_mode: c_cpp
|
||||
|
||||
Genshi:
|
||||
type: programming
|
||||
extensions:
|
||||
- .kid
|
||||
tm_scope: text.xml.genshi
|
||||
@@ -1023,6 +1031,7 @@ Genshi:
|
||||
ace_mode: xml
|
||||
|
||||
Gentoo Ebuild:
|
||||
type: programming
|
||||
group: Shell
|
||||
extensions:
|
||||
- .ebuild
|
||||
@@ -1030,6 +1039,7 @@ Gentoo Ebuild:
|
||||
ace_mode: sh
|
||||
|
||||
Gentoo Eclass:
|
||||
type: programming
|
||||
group: Shell
|
||||
extensions:
|
||||
- .eclass
|
||||
@@ -1037,6 +1047,7 @@ Gentoo Eclass:
|
||||
ace_mode: sh
|
||||
|
||||
Gettext Catalog:
|
||||
type: programming
|
||||
search_term: pot
|
||||
searchable: false
|
||||
aliases:
|
||||
@@ -1137,6 +1148,7 @@ Graphviz (DOT):
|
||||
ace_mode: text
|
||||
|
||||
Groff:
|
||||
type: programming
|
||||
extensions:
|
||||
- .man
|
||||
- '.1'
|
||||
@@ -1164,6 +1176,7 @@ Groovy:
|
||||
- groovy
|
||||
|
||||
Groovy Server Pages:
|
||||
type: programming
|
||||
group: Groovy
|
||||
aliases:
|
||||
- gsp
|
||||
@@ -1320,6 +1333,7 @@ INI:
|
||||
ace_mode: ini
|
||||
|
||||
IRC log:
|
||||
type: data
|
||||
search_term: irc
|
||||
aliases:
|
||||
- irc
|
||||
@@ -1350,6 +1364,7 @@ Inform 7:
|
||||
ace_mode: text
|
||||
|
||||
Inno Setup:
|
||||
type: programming
|
||||
extensions:
|
||||
- .iss
|
||||
tm_scope: source.inno
|
||||
@@ -1445,6 +1460,7 @@ Java:
|
||||
- .java
|
||||
|
||||
Java Server Pages:
|
||||
type: programming
|
||||
group: Java
|
||||
search_term: jsp
|
||||
aliases:
|
||||
@@ -1540,6 +1556,7 @@ LFE:
|
||||
ace_mode: lisp
|
||||
|
||||
LLVM:
|
||||
type: programming
|
||||
extensions:
|
||||
- .ll
|
||||
ace_mode: text
|
||||
@@ -1607,6 +1624,7 @@ Less:
|
||||
ace_mode: less
|
||||
|
||||
LilyPond:
|
||||
type: programming
|
||||
extensions:
|
||||
- .ly
|
||||
- .ily
|
||||
@@ -1745,6 +1763,7 @@ Makefile:
|
||||
ace_mode: makefile
|
||||
|
||||
Mako:
|
||||
type: programming
|
||||
extensions:
|
||||
- .mako
|
||||
- .mao
|
||||
@@ -1837,6 +1856,7 @@ Mercury:
|
||||
ace_mode: prolog
|
||||
|
||||
MiniD: # Legacy
|
||||
type: programming
|
||||
searchable: false
|
||||
extensions:
|
||||
- .minid # Dummy extension
|
||||
@@ -1884,12 +1904,14 @@ MoonScript:
|
||||
ace_mode: text
|
||||
|
||||
Myghty:
|
||||
type: programming
|
||||
extensions:
|
||||
- .myt
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
|
||||
NSIS:
|
||||
type: programming
|
||||
extensions:
|
||||
- .nsi
|
||||
- .nsh
|
||||
@@ -1981,6 +2003,7 @@ Nu:
|
||||
- nush
|
||||
|
||||
NumPy:
|
||||
type: programming
|
||||
group: Python
|
||||
extensions:
|
||||
- .numpy
|
||||
@@ -2440,6 +2463,7 @@ QML:
|
||||
ace_mode: text
|
||||
|
||||
QMake:
|
||||
type: programming
|
||||
extensions:
|
||||
- .pro
|
||||
- .pri
|
||||
@@ -2536,6 +2560,7 @@ Ragel in Ruby Host:
|
||||
ace_mode: text
|
||||
|
||||
Raw token data:
|
||||
type: data
|
||||
search_term: raw
|
||||
aliases:
|
||||
- raw
|
||||
@@ -2567,6 +2592,7 @@ Red:
|
||||
ace_mode: text
|
||||
|
||||
Redcode:
|
||||
type: programming
|
||||
extensions:
|
||||
- .cw
|
||||
tm_scope: none
|
||||
@@ -2853,6 +2879,7 @@ Smalltalk:
|
||||
ace_mode: text
|
||||
|
||||
Smarty:
|
||||
type: programming
|
||||
extensions:
|
||||
- .tpl
|
||||
ace_mode: smarty
|
||||
@@ -3276,6 +3303,7 @@ XQuery:
|
||||
ace_mode: xquery
|
||||
|
||||
XS:
|
||||
type: programming
|
||||
extensions:
|
||||
- .xs
|
||||
tm_scope: source.c
|
||||
@@ -3372,6 +3400,7 @@ fish:
|
||||
ace_mode: text
|
||||
|
||||
mupad:
|
||||
type: programming
|
||||
extensions:
|
||||
- .mu
|
||||
ace_mode: text
|
||||
|
||||
13
samples/Brainfuck/fib100.bf
Normal file
13
samples/Brainfuck/fib100.bf
Normal file
@@ -0,0 +1,13 @@
|
||||
# Calculate and output all fibonacci numbers under 100
|
||||
|
||||
+++++++++++
|
||||
>+>>>>++++++++++++++++++++++++++++++++++++++++++++
|
||||
>++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+>
|
||||
+<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[-
|
||||
<-[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<[>>>+<<<
|
||||
-]>>[-]]<<]>>>[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]
|
||||
>[<<+>>[-]]<<<<<<<]>>>>>[+++++++++++++++++++++++++
|
||||
+++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++
|
||||
++++++++++++++++++++++++++++++++++++++++++++.[-]<<
|
||||
<<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<<
|
||||
[-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-]
|
||||
4
samples/Brainfuck/hello.bf
Normal file
4
samples/Brainfuck/hello.bf
Normal file
@@ -0,0 +1,4 @@
|
||||
// More complex version of hello world
|
||||
|
||||
>++++++++[<+++++++++>-]<.>>+>+>++>[-]+<[>[->+<<++++>]<<]>.+++++++..+++.>
|
||||
>+++++++.<<<[[-]<[-]>]<+++++++++++++++.>>.+++.------.--------.>>+.>++++.
|
||||
3
samples/Brainfuck/helloworld.bf
Normal file
3
samples/Brainfuck/helloworld.bf
Normal file
@@ -0,0 +1,3 @@
|
||||
// Hello World
|
||||
|
||||
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
|
||||
30
samples/Brainfuck/rot13.bf
Normal file
30
samples/Brainfuck/rot13.bf
Normal file
@@ -0,0 +1,30 @@
|
||||
# ROT13 cipher
|
||||
|
||||
-,+[ Read first character and start outer character reading loop
|
||||
-[ Skip forward if character is 0
|
||||
>>++++[>++++++++<-] Set up divisor (32) for division loop
|
||||
(MEMORY LAYOUT: dividend copy remainder divisor quotient zero zero)
|
||||
<+<-[ Set up dividend (x minus 1) and enter division loop
|
||||
>+>+>-[>>>] Increase copy and remainder / reduce divisor / Normal case: skip forward
|
||||
<[[>+<-]>>+>] Special case: move remainder back to divisor and increase quotient
|
||||
<<<<<- Decrement dividend
|
||||
] End division loop
|
||||
]>>>[-]+ End skip loop; zero former divisor and reuse space for a flag
|
||||
>--[-[<->+++[-]]]<[ Zero that flag unless quotient was 2 or 3; zero quotient; check flag
|
||||
++++++++++++<[ If flag then set up divisor (13) for second division loop
|
||||
(MEMORY LAYOUT: zero copy dividend divisor remainder quotient zero zero)
|
||||
>-[>+>>] Reduce divisor; Normal case: increase remainder
|
||||
>[+[<+>-]>+>>] Special case: increase remainder / move it back to divisor / increase quotient
|
||||
<<<<<- Decrease dividend
|
||||
] End division loop
|
||||
>>[<+>-] Add remainder back to divisor to get a useful 13
|
||||
>[ Skip forward if quotient was 0
|
||||
-[ Decrement quotient and skip forward if quotient was 1
|
||||
-<<[-]>> Zero quotient and divisor if quotient was 2
|
||||
]<<[<<->>-]>> Zero divisor and subtract 13 from copy if quotient was 1
|
||||
]<<[<<+>>-] Zero divisor and add 13 to copy if quotient was 0
|
||||
] End outer skip loop (jump to here if ((character minus 1)/32) was not 2 or 3)
|
||||
<[-] Clear remainder from first division if second division was skipped
|
||||
<.[-] Output ROT13ed character from copy and clear it
|
||||
<-,+ Read next character
|
||||
] End character reading loop
|
||||
@@ -155,10 +155,6 @@ class TestLanguage < Minitest::Test
|
||||
assert_equal :prose, Language['Org'].type
|
||||
end
|
||||
|
||||
def test_other
|
||||
assert_nil Language['Brainfuck'].type
|
||||
end
|
||||
|
||||
def test_searchable
|
||||
assert Language['Ruby'].searchable?
|
||||
assert !Language['Gettext Catalog'].searchable?
|
||||
@@ -358,6 +354,15 @@ class TestLanguage < Minitest::Test
|
||||
assert missing.empty?, message
|
||||
end
|
||||
|
||||
def test_all_languages_have_type
|
||||
missing = Language.all.select { |language| language.type.nil? }
|
||||
message = "The following languages do not have a type 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", language.name) }.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)
|
||||
|
||||
Reference in New Issue
Block a user