summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2020-10-16 23:55:37 -0600
committerGitHub <noreply@github.com>2020-10-16 23:55:37 -0600
commitdf461f9510cdbe9afd392a6cb97d97c07ebdf477 (patch)
tree99e5a3680e3aa03710529b9bd540211f72b27c4c /test
parenta516e684d5de1e9835ce7563c99c934e43b902bd (diff)
resolves #3778 fix resolved value of :to_dir when both :to_file and :to_dir options are set to absolute paths (PR #3781)
Diffstat (limited to 'test')
-rw-r--r--test/api_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/api_test.rb b/test/api_test.rb
index f4b8fc26..277fb0fc 100644
--- a/test/api_test.rb
+++ b/test/api_test.rb
@@ -1320,6 +1320,22 @@ context 'API' do
end
end
+ test 'should resolve :to_dir option correctly when both :to_dir and :to_file options are set to an absolute path' do
+ begin
+ sample_input_path = fixture_path 'sample.adoc'
+ sample_output_file = Tempfile.new %w(out- .html)
+ sample_output_path = sample_output_file.path
+ sample_output_dir = File.dirname sample_output_path
+ sample_output_file.close
+ doc = Asciidoctor.convert_file sample_input_path, to_file: sample_output_path, to_dir: sample_output_dir, safe: :unsafe
+ assert File.exist? sample_output_path
+ assert_equal sample_output_path, doc.options[:to_file]
+ assert_equal sample_output_dir, doc.options[:to_dir]
+ ensure
+ sample_output_file.close!
+ end
+ end
+
test 'in_place option is ignored when to_file is specified' do
sample_input_path = fixture_path('sample.adoc')
sample_output_path = fixture_path('result.html')