mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Include binary op node to redundant return
This commit is contained in:
		
							parent
							
								
									6a913be980
								
							
						
					
					
						commit
						946ec67fae
					
				
					 2 changed files with 25 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -104,6 +104,26 @@ module Ameba::Rule::Style
 | 
			
		|||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context "binary op" do
 | 
			
		||||
      it "doesn't report if there is no return in the right binary op node" do
 | 
			
		||||
        s = Source.new %(
 | 
			
		||||
          def can_create?(a)
 | 
			
		||||
            valid? && a > 0
 | 
			
		||||
          end
 | 
			
		||||
        )
 | 
			
		||||
        subject.catch(s).should be_valid
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it "reports if there is return in the right binary op node" do
 | 
			
		||||
        s = Source.new %(
 | 
			
		||||
          def can_create?(a)
 | 
			
		||||
            valid? && return a > 0
 | 
			
		||||
          end
 | 
			
		||||
        )
 | 
			
		||||
        subject.catch(s).should_not be_valid
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context "case" do
 | 
			
		||||
      it "reports if there are returns in whens" do
 | 
			
		||||
        s = Source.new %(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue