mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Normalize sources for tests
This commit is contained in:
		
							parent
							
								
									cb5f802012
								
							
						
					
					
						commit
						d7b0e10d1e
					
				
					 27 changed files with 89 additions and 65 deletions
				
			
		| 
						 | 
				
			
			@ -42,7 +42,7 @@ module Ameba
 | 
			
		|||
      subject.catch(s).should_not be_valid
 | 
			
		||||
      issue = s.issues.first
 | 
			
		||||
      issue.rule.should_not be_nil
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:2:9"
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:1:1"
 | 
			
		||||
      issue.message.should eq(
 | 
			
		||||
        "Constant name should be screaming-cased: CONST, not Const"
 | 
			
		||||
      )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -112,12 +112,12 @@ module Ameba
 | 
			
		|||
 | 
			
		||||
    it "reports rule, pos and message" do
 | 
			
		||||
      s = Source.new %q(
 | 
			
		||||
         1200000
 | 
			
		||||
        1200000
 | 
			
		||||
      ), "source.cr"
 | 
			
		||||
      subject.catch(s).should_not be_valid
 | 
			
		||||
      issue = s.issues.first
 | 
			
		||||
      issue.rule.should_not be_nil
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:2:10"
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:1:1"
 | 
			
		||||
      issue.message.should match /1_200_000/
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ module Ameba
 | 
			
		|||
      subject.catch(s).should_not be_valid
 | 
			
		||||
      issue = s.issues.first
 | 
			
		||||
      issue.rule.should_not be_nil
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:2:9"
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:1:1"
 | 
			
		||||
      issue.message.should eq(
 | 
			
		||||
        "Method name should be underscore-cased: bad_name, not bad_Name"
 | 
			
		||||
      )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ module Ameba::Rule::Style
 | 
			
		|||
 | 
			
		||||
      issue = s.issues.first
 | 
			
		||||
      issue.rule.should_not be_nil
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:3:11"
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:2:3"
 | 
			
		||||
      issue.message.should eq(
 | 
			
		||||
        "Favour method name 'picture?' over 'has_picture?'")
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -206,7 +206,7 @@ module Ameba::Rule::Style
 | 
			
		|||
 | 
			
		||||
      issue = s.issues.first
 | 
			
		||||
      issue.rule.should_not be_nil
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:2:9"
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:1:1"
 | 
			
		||||
      issue.message.should eq "Redundant `begin` block detected"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,7 +51,7 @@ module Ameba
 | 
			
		|||
      subject.catch(s).should_not be_valid
 | 
			
		||||
      issue = s.issues.first
 | 
			
		||||
      issue.rule.should_not be_nil
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:2:9"
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:1:1"
 | 
			
		||||
      issue.message.should eq(
 | 
			
		||||
        "Type name should be camelcased: MyClass, but it was My_class"
 | 
			
		||||
      )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ module Ameba::Rule::Style
 | 
			
		|||
      issue = s.issues.first
 | 
			
		||||
      issue.should_not be_nil
 | 
			
		||||
      issue.rule.should_not be_nil
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:2:9"
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:1:1"
 | 
			
		||||
      issue.message.should eq "Favour if over unless with else"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,7 +52,7 @@ module Ameba
 | 
			
		|||
      subject.catch(s).should_not be_valid
 | 
			
		||||
      issue = s.issues.first
 | 
			
		||||
      issue.rule.should_not be_nil
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:2:9"
 | 
			
		||||
      issue.location.to_s.should eq "source.cr:1:1"
 | 
			
		||||
      issue.message.should eq(
 | 
			
		||||
        "Var name should be underscore-cased: bad_name, not badName"
 | 
			
		||||
      )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue