Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Adding two new test cases for exclude configuration use cases. #2046

Closed
wants to merge 1 commit into from

2 participants

@jbranchaud

Here are two new shoulda test cases for test_entry_filter.rb:

  • The first ensures that an excluded directory is based on the source directory, so a subdirectory elsewhere by the same name will not be excluded. This test passes. In 1.4.3, if css was in exclude list, then css and the css inside vendor/ would both be excluded, though only the former was intended for exclusion.

  • The second is to check if excluding a directory by name will exclude the files in that directory. This test does not pass, though it seems inconsistent with my experience using Jekyll 1.4.3 (css and all the files it contains should be excluded).

@jbranchaud jbranchaud Adding two new test cases for exclude configuration use cases.
12cfdbd
@jbranchaud

I have not contributed tests to Jekyll before, so if there is anyway that I can improve the above commit, I would appreciate the guidance to do so.

@parkr
Owner

@jbranchaud Would you mind fixing the tests? It appears at least one fails.

@jbranchaud

@parkr I was hoping that failing test would spark some discussion about how the entry_filter is implemented.

In that test case, when css is in the list of excludes, it appears to exclude the css directory, but not the files in the css directory (e.g. css/main.css). Perhaps it is given that if you exclude css, then css/main.css will be implicitly excluded. However, according to the test I have written, this is not the case, hence it failing.

At this point, I am wondering if I have poorly written a test case, if test_entry_filter.rb cannot handle/test this kind of scenario, or if there is in fact a bug in entry_filter.rb.

@jbranchaud

The same issue I discussed above is pointed out in the notes of the Yeoman Jekyll generator.

@parkr parkr closed this
@parkr parkr reopened this
@parkr parkr closed this in #2303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 14, 2014
  1. @jbranchaud

    Adding two new test cases for exclude configuration use cases.

    jbranchaud authored
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 0 deletions.
  1. +16 −0 test/test_entry_filter.rb
View
16 test/test_entry_filter.rb
@@ -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]
Something went wrong with that request. Please try again.