Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pedantic test failures for github-linguist/linguist#6775 #1

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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