Merge pull request #2153 from github/enforce-type

Test that languages have a type
This commit is contained in:
Garen Torikian
2015-02-24 13:34:22 -08:00
6 changed files with 88 additions and 4 deletions

View File

@@ -271,6 +271,7 @@ Batchfile:
ace_mode: batchfile ace_mode: batchfile
Befunge: Befunge:
type: programming
extensions: extensions:
- .befunge - .befunge
ace_mode: text ace_mode: text
@@ -326,6 +327,7 @@ Boo:
ace_mode: text ace_mode: text
Brainfuck: Brainfuck:
type: programming
extensions: extensions:
- .b - .b
- .bf - .bf
@@ -421,6 +423,7 @@ CLIPS:
ace_mode: text ace_mode: text
CMake: CMake:
type: programming
extensions: extensions:
- .cmake - .cmake
- .cmake.in - .cmake.in
@@ -480,6 +483,7 @@ Chapel:
ace_mode: text ace_mode: text
ChucK: ChucK:
type: programming
extensions: extensions:
- .ck - .ck
tm_scope: source.java tm_scope: source.java
@@ -641,6 +645,7 @@ Crystal:
- crystal - crystal
Cucumber: Cucumber:
type: programming
extensions: extensions:
- .feature - .feature
tm_scope: text.gherkin.feature tm_scope: text.gherkin.feature
@@ -700,6 +705,7 @@ DM:
ace_mode: c_cpp ace_mode: c_cpp
Darcs Patch: Darcs Patch:
type: programming
search_term: dpatch search_term: dpatch
aliases: aliases:
- dpatch - dpatch
@@ -717,6 +723,7 @@ Dart:
ace_mode: dart ace_mode: dart
Diff: Diff:
type: programming
extensions: extensions:
- .diff - .diff
- .patch - .patch
@@ -1014,6 +1021,7 @@ Game Maker Language:
ace_mode: c_cpp ace_mode: c_cpp
Genshi: Genshi:
type: programming
extensions: extensions:
- .kid - .kid
tm_scope: text.xml.genshi tm_scope: text.xml.genshi
@@ -1023,6 +1031,7 @@ Genshi:
ace_mode: xml ace_mode: xml
Gentoo Ebuild: Gentoo Ebuild:
type: programming
group: Shell group: Shell
extensions: extensions:
- .ebuild - .ebuild
@@ -1030,6 +1039,7 @@ Gentoo Ebuild:
ace_mode: sh ace_mode: sh
Gentoo Eclass: Gentoo Eclass:
type: programming
group: Shell group: Shell
extensions: extensions:
- .eclass - .eclass
@@ -1037,6 +1047,7 @@ Gentoo Eclass:
ace_mode: sh ace_mode: sh
Gettext Catalog: Gettext Catalog:
type: programming
search_term: pot search_term: pot
searchable: false searchable: false
aliases: aliases:
@@ -1137,6 +1148,7 @@ Graphviz (DOT):
ace_mode: text ace_mode: text
Groff: Groff:
type: programming
extensions: extensions:
- .man - .man
- '.1' - '.1'
@@ -1164,6 +1176,7 @@ Groovy:
- groovy - groovy
Groovy Server Pages: Groovy Server Pages:
type: programming
group: Groovy group: Groovy
aliases: aliases:
- gsp - gsp
@@ -1320,6 +1333,7 @@ INI:
ace_mode: ini ace_mode: ini
IRC log: IRC log:
type: data
search_term: irc search_term: irc
aliases: aliases:
- irc - irc
@@ -1350,6 +1364,7 @@ Inform 7:
ace_mode: text ace_mode: text
Inno Setup: Inno Setup:
type: programming
extensions: extensions:
- .iss - .iss
tm_scope: source.inno tm_scope: source.inno
@@ -1445,6 +1460,7 @@ Java:
- .java - .java
Java Server Pages: Java Server Pages:
type: programming
group: Java group: Java
search_term: jsp search_term: jsp
aliases: aliases:
@@ -1540,6 +1556,7 @@ LFE:
ace_mode: lisp ace_mode: lisp
LLVM: LLVM:
type: programming
extensions: extensions:
- .ll - .ll
ace_mode: text ace_mode: text
@@ -1607,6 +1624,7 @@ Less:
ace_mode: less ace_mode: less
LilyPond: LilyPond:
type: programming
extensions: extensions:
- .ly - .ly
- .ily - .ily
@@ -1745,6 +1763,7 @@ Makefile:
ace_mode: makefile ace_mode: makefile
Mako: Mako:
type: programming
extensions: extensions:
- .mako - .mako
- .mao - .mao
@@ -1837,6 +1856,7 @@ Mercury:
ace_mode: prolog ace_mode: prolog
MiniD: # Legacy MiniD: # Legacy
type: programming
searchable: false searchable: false
extensions: extensions:
- .minid # Dummy extension - .minid # Dummy extension
@@ -1884,12 +1904,14 @@ MoonScript:
ace_mode: text ace_mode: text
Myghty: Myghty:
type: programming
extensions: extensions:
- .myt - .myt
tm_scope: none tm_scope: none
ace_mode: text ace_mode: text
NSIS: NSIS:
type: programming
extensions: extensions:
- .nsi - .nsi
- .nsh - .nsh
@@ -1981,6 +2003,7 @@ Nu:
- nush - nush
NumPy: NumPy:
type: programming
group: Python group: Python
extensions: extensions:
- .numpy - .numpy
@@ -2440,6 +2463,7 @@ QML:
ace_mode: text ace_mode: text
QMake: QMake:
type: programming
extensions: extensions:
- .pro - .pro
- .pri - .pri
@@ -2536,6 +2560,7 @@ Ragel in Ruby Host:
ace_mode: text ace_mode: text
Raw token data: Raw token data:
type: data
search_term: raw search_term: raw
aliases: aliases:
- raw - raw
@@ -2567,6 +2592,7 @@ Red:
ace_mode: text ace_mode: text
Redcode: Redcode:
type: programming
extensions: extensions:
- .cw - .cw
tm_scope: none tm_scope: none
@@ -2853,6 +2879,7 @@ Smalltalk:
ace_mode: text ace_mode: text
Smarty: Smarty:
type: programming
extensions: extensions:
- .tpl - .tpl
ace_mode: smarty ace_mode: smarty
@@ -3276,6 +3303,7 @@ XQuery:
ace_mode: xquery ace_mode: xquery
XS: XS:
type: programming
extensions: extensions:
- .xs - .xs
tm_scope: source.c tm_scope: source.c
@@ -3372,6 +3400,7 @@ fish:
ace_mode: text ace_mode: text
mupad: mupad:
type: programming
extensions: extensions:
- .mu - .mu
ace_mode: text ace_mode: text

View File

@@ -0,0 +1,13 @@
# Calculate and output all fibonacci numbers under 100
+++++++++++
>+>>>>++++++++++++++++++++++++++++++++++++++++++++
>++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+>
+<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[-
<-[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<[>>>+<<<
-]>>[-]]<<]>>>[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]
>[<<+>>[-]]<<<<<<<]>>>>>[+++++++++++++++++++++++++
+++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++
++++++++++++++++++++++++++++++++++++++++++++.[-]<<
<<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<<
[-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-]

View File

@@ -0,0 +1,4 @@
// More complex version of hello world
>++++++++[<+++++++++>-]<.>>+>+>++>[-]+<[>[->+<<++++>]<<]>.+++++++..+++.>
>+++++++.<<<[[-]<[-]>]<+++++++++++++++.>>.+++.------.--------.>>+.>++++.

View File

@@ -0,0 +1,3 @@
// Hello World
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

View 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

View File

@@ -155,10 +155,6 @@ class TestLanguage < Minitest::Test
assert_equal :prose, Language['Org'].type assert_equal :prose, Language['Org'].type
end end
def test_other
assert_nil Language['Brainfuck'].type
end
def test_searchable def test_searchable
assert Language['Ruby'].searchable? assert Language['Ruby'].searchable?
assert !Language['Gettext Catalog'].searchable? assert !Language['Gettext Catalog'].searchable?
@@ -358,6 +354,15 @@ class TestLanguage < Minitest::Test
assert missing.empty?, message assert missing.empty?, message
end 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 def test_all_languages_have_a_valid_ace_mode
ace_fixture_path = File.join('test', 'fixtures', 'ace_modes.json') ace_fixture_path = File.join('test', 'fixtures', 'ace_modes.json')
skip("No ace_modes.json file") unless File.exist?(ace_fixture_path) skip("No ace_modes.json file") unless File.exist?(ace_fixture_path)