test/paths_test.rb in asciidoctor-1.5.6 vs test/paths_test.rb in asciidoctor-1.5.6.1
- old
+ new
@@ -246,9 +246,16 @@
filename = @resolver.system_path('part1/chapter1/section1.adoc', nil, JAIL)
assert_equal "#{JAIL}/part1/chapter1/section1.adoc", filename
assert_equal 'part1/chapter1/section1.adoc', @resolver.relative_path(filename, JAIL)
end
+ test 'should resolve relative path to filename if does not share common root with base directory' do
+ filename = '/docs/partials'
+ base_dir = '/home/user/docs'
+ result = @resolver.relative_path filename, base_dir
+ assert_equal filename, result
+ end
+
test 'should resolve relative path relative to base dir in unsafe mode' do
base_dir = fixture_path 'base'
doc = empty_document :base_dir => base_dir, :safe => Asciidoctor::SafeMode::UNSAFE
expected = ::File.join base_dir, 'images', 'tiger.png'
actual = doc.normalize_system_path 'tiger.png', 'images'