Merge pull request #2303 from jekyll/jbranchaud-adding_exclude_tests

This commit is contained in:
Parker Moore 2014-05-06 14:40:18 -04:00
commit 6c1bb76316
2 changed files with 17 additions and 3 deletions

View File

@ -65,9 +65,7 @@ module Jekyll
entry = ensure_leading_slash(e)
enum.any? do |exp|
item = ensure_leading_slash(exp)
Jekyll.logger.debug "glob_include?(#{entry})"
Jekyll.logger.debug " ==> File.fnmatch?(#{item}, #{entry}) == #{File.fnmatch?(item, entry)}"
File.fnmatch?(item, entry)
File.fnmatch?(item, entry) || entry.start_with?(item)
end
end
end

View File

@ -25,6 +25,22 @@ class TestEntryFilter < Test::Unit::TestCase
assert_equal files, @site.filter_entries(excludes + files + ["excludeA"])
end
should "filter entries with exclude relative to site source" do
excludes = %w[README TODO css]
files = %w[index.html vendor/css .htaccess]
@site.exclude = excludes
assert_equal files, @site.filter_entries(excludes + files + ["css"])
end
should "filter excluded directory and contained files" do
excludes = %w[README TODO css]
files = %w[index.html .htaccess]
@site.exclude = excludes
assert_equal files, @site.filter_entries(excludes + files + ["css", "css/main.css", "css/vendor.css"])
end
should "not filter entries within include" do
includes = %w[_index.html .htaccess include*]
files = %w[index.html _index.html .htaccess includeA]