Merge pull request #5526 from ashmaroli/fix-win-tests
Merge pull request 5526
This commit is contained in:
commit
3e1fad273b
|
@ -158,4 +158,11 @@ class JekyllUnitTest < Minitest::Test
|
||||||
str
|
str
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def skip_if_windows(msg = nil)
|
||||||
|
if Utils::Platforms.really_windows?
|
||||||
|
msg ||= "Jekyll does not currently support this feature on Windows."
|
||||||
|
skip msg.to_s.magenta
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -186,6 +186,9 @@ class TestCollections < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "include the symlinked file from site.source in the list of docs" do
|
should "include the symlinked file from site.source in the list of docs" do
|
||||||
|
# no support for including symlinked file on Windows
|
||||||
|
skip_if_windows "Jekyll does not currently support symlinks on Windows."
|
||||||
|
|
||||||
assert_includes @collection.docs.map(&:relative_path), "_methods/um_hi.md"
|
assert_includes @collection.docs.map(&:relative_path), "_methods/um_hi.md"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -82,6 +82,9 @@ class TestEntryFilter < JekyllUnitTest
|
||||||
|
|
||||||
# rubocop:disable Performance/FixedSize
|
# rubocop:disable Performance/FixedSize
|
||||||
should "include only safe symlinks in safe mode" do
|
should "include only safe symlinks in safe mode" do
|
||||||
|
# no support for symlinks on Windows
|
||||||
|
skip_if_windows "Jekyll does not currently support symlinks on Windows."
|
||||||
|
|
||||||
site = Site.new(site_configuration("safe" => true))
|
site = Site.new(site_configuration("safe" => true))
|
||||||
site.reader.read_directories("symlink-test")
|
site.reader.read_directories("symlink-test")
|
||||||
|
|
||||||
|
@ -91,6 +94,9 @@ class TestEntryFilter < JekyllUnitTest
|
||||||
# rubocop:enable Performance/FixedSize
|
# rubocop:enable Performance/FixedSize
|
||||||
|
|
||||||
should "include symlinks in unsafe mode" do
|
should "include symlinks in unsafe mode" do
|
||||||
|
# no support for symlinks on Windows
|
||||||
|
skip_if_windows "Jekyll does not currently support symlinks on Windows."
|
||||||
|
|
||||||
site = Site.new(site_configuration)
|
site = Site.new(site_configuration)
|
||||||
|
|
||||||
site.reader.read_directories("symlink-test")
|
site.reader.read_directories("symlink-test")
|
||||||
|
|
|
@ -575,7 +575,9 @@ class TestFilters < JekyllUnitTest
|
||||||
g["items"].is_a?(Array),
|
g["items"].is_a?(Array),
|
||||||
"The list of grouped items for 'default' is not an Array."
|
"The list of grouped items for 'default' is not an Array."
|
||||||
)
|
)
|
||||||
assert_equal 5, g["items"].size
|
# adjust array.size to ignore symlinked page in Windows
|
||||||
|
qty = Utils::Platforms.really_windows? ? 4 : 5
|
||||||
|
assert_equal qty, g["items"].size
|
||||||
when "nil"
|
when "nil"
|
||||||
assert(
|
assert(
|
||||||
g["items"].is_a?(Array),
|
g["items"].is_a?(Array),
|
||||||
|
@ -587,7 +589,9 @@ class TestFilters < JekyllUnitTest
|
||||||
g["items"].is_a?(Array),
|
g["items"].is_a?(Array),
|
||||||
"The list of grouped items for '' is not an Array."
|
"The list of grouped items for '' is not an Array."
|
||||||
)
|
)
|
||||||
assert_equal 15, g["items"].size
|
# adjust array.size to ignore symlinked page in Windows
|
||||||
|
qty = Utils::Platforms.really_windows? ? 14 : 15
|
||||||
|
assert_equal qty, g["items"].size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,11 +50,13 @@ class TestGeneratedSite < JekyllUnitTest
|
||||||
|
|
||||||
should "print a nice list of static files" do
|
should "print a nice list of static files" do
|
||||||
time_regexp = "\\d+:\\d+"
|
time_regexp = "\\d+:\\d+"
|
||||||
|
#
|
||||||
|
# adding a pipe character at the beginning preserves formatting with newlines
|
||||||
expected_output = Regexp.new <<-OUTPUT
|
expected_output = Regexp.new <<-OUTPUT
|
||||||
- /css/screen.css last edited at #{time_regexp} with extname .css
|
| - /css/screen.css last edited at #{time_regexp} with extname .css
|
||||||
- /pgp.key last edited at #{time_regexp} with extname .key
|
- /pgp.key last edited at #{time_regexp} with extname .key
|
||||||
- /products.yml last edited at #{time_regexp} with extname .yml
|
- /products.yml last edited at #{time_regexp} with extname .yml
|
||||||
- /symlink-test/symlinked-dir/screen.css last edited at #{time_regexp} with extname .css
|
- /symlink-test/symlinked-dir/screen.css last edited at #{time_regexp} with extname .css
|
||||||
OUTPUT
|
OUTPUT
|
||||||
assert_match expected_output, File.read(dest_dir("static_files.html"))
|
assert_match expected_output, File.read(dest_dir("static_files.html"))
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,14 +14,20 @@ class TestSite < JekyllUnitTest
|
||||||
|
|
||||||
should "have an array for plugins if passed as a string" do
|
should "have an array for plugins if passed as a string" do
|
||||||
site = Site.new(site_configuration({ "plugins_dir" => "/tmp/plugins" }))
|
site = Site.new(site_configuration({ "plugins_dir" => "/tmp/plugins" }))
|
||||||
assert_equal ["/tmp/plugins"], site.plugins
|
array = Utils::Platforms.windows? ? ["C:/tmp/plugins"] : ["/tmp/plugins"]
|
||||||
|
assert_equal array, site.plugins
|
||||||
end
|
end
|
||||||
|
|
||||||
should "have an array for plugins if passed as an array" do
|
should "have an array for plugins if passed as an array" do
|
||||||
site = Site.new(site_configuration({
|
site = Site.new(site_configuration({
|
||||||
"plugins_dir" => ["/tmp/plugins", "/tmp/otherplugins"]
|
"plugins_dir" => ["/tmp/plugins", "/tmp/otherplugins"]
|
||||||
}))
|
}))
|
||||||
assert_equal ["/tmp/plugins", "/tmp/otherplugins"], site.plugins
|
array = if Utils::Platforms.windows?
|
||||||
|
["C:/tmp/plugins", "C:/tmp/otherplugins"]
|
||||||
|
else
|
||||||
|
["/tmp/plugins", "/tmp/otherplugins"]
|
||||||
|
end
|
||||||
|
assert_equal array, site.plugins
|
||||||
end
|
end
|
||||||
|
|
||||||
should "have an empty array for plugins if nothing is passed" do
|
should "have an empty array for plugins if nothing is passed" do
|
||||||
|
@ -175,7 +181,8 @@ class TestSite < JekyllUnitTest
|
||||||
method.call(*args, &block).reverse
|
method.call(*args, &block).reverse
|
||||||
end
|
end
|
||||||
@site.process
|
@site.process
|
||||||
# files in symlinked directories may appear twice
|
# exclude files in symlinked directories here and insert them in the
|
||||||
|
# following step when not on Windows.
|
||||||
sorted_pages = %w(
|
sorted_pages = %w(
|
||||||
%#\ +.md
|
%#\ +.md
|
||||||
.htaccess
|
.htaccess
|
||||||
|
@ -194,12 +201,14 @@ class TestSite < JekyllUnitTest
|
||||||
index.html
|
index.html
|
||||||
info.md
|
info.md
|
||||||
main.scss
|
main.scss
|
||||||
main.scss
|
|
||||||
properties.html
|
properties.html
|
||||||
sitemap.xml
|
sitemap.xml
|
||||||
static_files.html
|
static_files.html
|
||||||
symlinked-file
|
|
||||||
)
|
)
|
||||||
|
unless Utils::Platforms.really_windows?
|
||||||
|
# files in symlinked directories may appear twice
|
||||||
|
sorted_pages.push("main.scss", "symlinked-file").sort!
|
||||||
|
end
|
||||||
assert_equal sorted_pages, @site.pages.map(&:name)
|
assert_equal sorted_pages, @site.pages.map(&:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -268,19 +277,19 @@ class TestSite < JekyllUnitTest
|
||||||
@site.process
|
@site.process
|
||||||
# generate some orphaned files:
|
# generate some orphaned files:
|
||||||
# single file
|
# single file
|
||||||
File.open(dest_dir("obsolete.html"), "w")
|
FileUtils.touch(dest_dir("obsolete.html"))
|
||||||
# single file in sub directory
|
# single file in sub directory
|
||||||
FileUtils.mkdir(dest_dir("qux"))
|
FileUtils.mkdir(dest_dir("qux"))
|
||||||
File.open(dest_dir("qux/obsolete.html"), "w")
|
FileUtils.touch(dest_dir("qux/obsolete.html"))
|
||||||
# empty directory
|
# empty directory
|
||||||
FileUtils.mkdir(dest_dir("quux"))
|
FileUtils.mkdir(dest_dir("quux"))
|
||||||
FileUtils.mkdir(dest_dir(".git"))
|
FileUtils.mkdir(dest_dir(".git"))
|
||||||
FileUtils.mkdir(dest_dir(".svn"))
|
FileUtils.mkdir(dest_dir(".svn"))
|
||||||
FileUtils.mkdir(dest_dir(".hg"))
|
FileUtils.mkdir(dest_dir(".hg"))
|
||||||
# single file in repository
|
# single file in repository
|
||||||
File.open(dest_dir(".git/HEAD"), "w")
|
FileUtils.touch(dest_dir(".git/HEAD"))
|
||||||
File.open(dest_dir(".svn/HEAD"), "w")
|
FileUtils.touch(dest_dir(".svn/HEAD"))
|
||||||
File.open(dest_dir(".hg/HEAD"), "w")
|
FileUtils.touch(dest_dir(".hg/HEAD"))
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
|
|
|
@ -55,6 +55,9 @@ class TestTheme < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "return the resolved path when a symlink & resolved path exists" do
|
should "return the resolved path when a symlink & resolved path exists" do
|
||||||
|
# no support for symlinks on Windows
|
||||||
|
skip_if_windows "Jekyll does not currently support symlinks on Windows."
|
||||||
|
|
||||||
expected = File.expand_path("./_layouts", @expected_root)
|
expected = File.expand_path("./_layouts", @expected_root)
|
||||||
assert_equal expected, @theme.send(:path_for, :_symlink)
|
assert_equal expected, @theme.send(:path_for, :_symlink)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue