Skip to content

Commit

Permalink
Merge pull request #1 from Cutlery-Drawer/typespec-fixes
Browse files Browse the repository at this point in the history
Fix pedantic test failures for github-linguist#6775
  • Loading branch information
timotheeguerin committed Apr 4, 2024
2 parents d9d1447 + 392acb1 commit b6a5c6b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
12 changes: 6 additions & 6 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,12 @@ disambiguations:
- language: XML
pattern: '<TS\b'
- language: TypeScript
- extensions: ['.tsp']
rules:
- language: TypeSpec
pattern: '^(import|using|namespace|interface|op|model|scalar|alias|union|enum)\s'
- language: TSPLIB data
pattern: '^(NAME|TYPE|DIMENSION|EDGE_WEIGHT_TYPE|EDGE_WEIGHT_FORMAT)\s*:'
- extensions: ['.tst']
rules:
- language: GAP
Expand Down Expand Up @@ -841,12 +847,6 @@ disambiguations:
- language: JSON
pattern: '\"modelName\"\:\s*\"GM'
- language: Yacc
- extensions: ['.tsp']
rules:
- language: TypeSpec
pattern: '^(import|using|namespace|interface|op|model|scalar|alias|union|enum)\s'
- language: TSPLIB data
pattern: '^(NAME|TYPE|DIMENSION|EDGE_WEIGHT_TYPE|EDGE_WEIGHT_FORMAT)\s*:'
named_patterns:
cpp:
- '^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set|(i|o|io)stream)>'
Expand Down
39 changes: 20 additions & 19 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7001,6 +7001,16 @@ TOML:
codemirror_mode: toml
codemirror_mime_type: text/x-toml
language_id: 365
TSPLIB data:
aliases:
- travelling salesman problem
- traveling salesman problem
type: data
extensions:
- ".tsp"
tm_scope: none
ace_mode: text
language_id: 89289301
TSQL:
type: programming
color: "#e38c00"
Expand Down Expand Up @@ -7292,6 +7302,16 @@ TypeScript:
codemirror_mode: javascript
codemirror_mime_type: application/typescript
language_id: 378
TypeSpec:
type: programming
color: "#4A3665"
aliases:
- tsp
extensions:
- ".tsp"
tm_scope: source.tsp
ace_mode: text
language_id: 952272597
Typst:
type: programming
color: "#239dad"
Expand Down Expand Up @@ -8412,22 +8432,3 @@ xBase:
tm_scope: source.harbour
ace_mode: text
language_id: 421
TypeSpec:
type: programming
color: "#4A3665"
aliases:
- tsp
extensions:
- ".tsp"
tm_scope: source.tsp
ace_mode: text
language_id: 952272597
TSPLIB data:
aliases:
- travelling salesman problem
- traveling salesman problem
type: data
extensions:
- ".tsp"
ace_mode: text
language_id: 89289301
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions test/test_heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,13 @@ def test_ts_by_heuristics
})
end

def test_tsp_by_heuristics
assert_heuristics({
"TypeSpec" => all_fixtures("TypeSpec", "*.tsp"),
"TSPLIB data" => all_fixtures("TSPLIB data", "*.tsp")
})
end

def test_tst_by_heuristics
assert_heuristics({
"GAP" => all_fixtures("GAP", "*.tst"),
Expand Down

0 comments on commit b6a5c6b

Please sign in to comment.