mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Fix empty .m file
This commit is contained in:
@@ -470,7 +470,7 @@ module Linguist
|
||||
Language['Objective-C']
|
||||
|
||||
# Matlab file function or class or comments
|
||||
elsif lines.first.grep(/^\s*(function |classdef )/).any? || lines.grep(/^\s*%/).any?
|
||||
elsif lines.any? && lines.first.grep(/^\s*(function |classdef )/).any? || lines.grep(/^\s*%/).any?
|
||||
Language['Matlab']
|
||||
|
||||
# Fallback to Objective-C, don't want any Matlab false positives
|
||||
|
||||
0
test/fixtures/empty.m
vendored
Normal file
0
test/fixtures/empty.m
vendored
Normal file
@@ -307,6 +307,7 @@ class TestBlob < Test::Unit::TestCase
|
||||
assert_equal Language['Perl'], blob("test-perl2.pl").language
|
||||
|
||||
# .m disambiguation
|
||||
assert_equal Language['Objective-C'], blob("empty.m").language
|
||||
assert_equal Language['Objective-C'], blob("Foo.m").language
|
||||
assert_equal Language['Objective-C'], blob("hello.m").language
|
||||
assert_equal Language['Matlab'], blob("matlab_function.m").language
|
||||
|
||||
Reference in New Issue
Block a user