mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Handle duplicated files on GlobUtils (#151)
* Handle duplicated files on GlobUtils * Update src/ameba/glob_utils.cr Co-Authored-By: George Dietrich <yomoejoe@gmail.com> Co-authored-by: George Dietrich <yomoejoe@gmail.com>
This commit is contained in:
		
							parent
							
								
									b215b34060
								
							
						
					
					
						commit
						f1adf14527
					
				
					 2 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
					@ -26,6 +26,13 @@ module Ameba
 | 
				
			||||||
          .find_files_by_globs(["**/*_spec.cr", "!**/#{current_file_basename}"])
 | 
					          .find_files_by_globs(["**/*_spec.cr", "!**/#{current_file_basename}"])
 | 
				
			||||||
          .should_not contain current_file_path
 | 
					          .should_not contain current_file_path
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      it "doesn't return duplicated globs" do
 | 
				
			||||||
 | 
					        subject
 | 
				
			||||||
 | 
					          .find_files_by_globs(["**/*_spec.cr", "**/*_spec.cr"])
 | 
				
			||||||
 | 
					          .count(current_file_path)
 | 
				
			||||||
 | 
					          .should eq 1
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    describe "#expand" do
 | 
					    describe "#expand" do
 | 
				
			||||||
| 
						 | 
					@ -33,6 +40,11 @@ module Ameba
 | 
				
			||||||
        subject.expand(["**/#{current_file_basename}"])
 | 
					        subject.expand(["**/#{current_file_basename}"])
 | 
				
			||||||
          .should eq [current_file_path]
 | 
					          .should eq [current_file_path]
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      it "does not list duplicated files" do
 | 
				
			||||||
 | 
					        subject.expand(["**/#{current_file_basename}", "**/#{current_file_basename}"])
 | 
				
			||||||
 | 
					          .should eq [current_file_path]
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,7 +25,7 @@ module Ameba
 | 
				
			||||||
      globs.map do |glob|
 | 
					      globs.map do |glob|
 | 
				
			||||||
        glob += "/**/*.cr" if File.directory?(glob)
 | 
					        glob += "/**/*.cr" if File.directory?(glob)
 | 
				
			||||||
        Dir[glob]
 | 
					        Dir[glob]
 | 
				
			||||||
      end.flatten
 | 
					      end.flatten.uniq!
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private def rejected_globs(globs)
 | 
					    private def rejected_globs(globs)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue