mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Heuristic rule for TeX .cls files (#3360)
This commit is contained in:
		
				
					committed by
					
						
						Brandon Black
					
				
			
			
				
	
			
			
			
						parent
						
							cd30c7613c
						
					
				
				
					commit
					79f20e8057
				
			@@ -110,6 +110,12 @@ module Linguist
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    disambiguate ".cls" do |data|
 | 
			
		||||
      if /\\\w+{/.match(data)
 | 
			
		||||
        Language["TeX"]
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    disambiguate ".cs" do |data|
 | 
			
		||||
      if /![\w\s]+methodsFor: /.match(data)
 | 
			
		||||
        Language["Smalltalk"]
 | 
			
		||||
 
 | 
			
		||||
@@ -73,6 +73,15 @@ class TestHeuristcs < Minitest::Test
 | 
			
		||||
    })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_cls_by_heuristics
 | 
			
		||||
    assert_heuristics({
 | 
			
		||||
      "TeX" => all_fixtures("TeX", "*.cls"),
 | 
			
		||||
      nil => all_fixtures("Apex", "*.cls"),
 | 
			
		||||
      nil => all_fixtures("OpenEdge ABL", "*.cls"),
 | 
			
		||||
      nil => all_fixtures("Visual Basic", "*.cls"),
 | 
			
		||||
    })
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_cs_by_heuristics
 | 
			
		||||
    assert_heuristics({
 | 
			
		||||
      "C#" => all_fixtures("C#", "*.cs"),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user