summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2021-04-27 04:43:05 -0600
committerGitHub <noreply@github.com>2021-04-27 04:43:05 -0600
commit0fb24efc93366236de1bbb4df56eee804bdf95c6 (patch)
treea50969b79d55d376078e25b306511467901b4874 /test
parentab097874b0ce6bf7db5f39eadb2ff7ed0aa00db6 (diff)
fix invoker tests that use run_command on JRuby 9.1 for Windows (PR #4042)
Diffstat (limited to 'test')
-rw-r--r--test/invoker_test.rb10
-rw-r--r--test/test_helper.rb7
2 files changed, 11 insertions, 6 deletions
diff --git a/test/invoker_test.rb b/test/invoker_test.rb
index f31ad896..eae5cebb 100644
--- a/test/invoker_test.rb
+++ b/test/invoker_test.rb
@@ -678,7 +678,7 @@ context 'Invoker' do
assert_equal 'erubi', doc.instance_variable_get('@options')[:eruby]
end
- test 'should force default external encoding to UTF-8', unless: jruby_9_1_windows? do
+ test 'should force default external encoding to UTF-8' do
input_path = fixture_path 'encoding.adoc'
# using open3 to work around a bug in JRuby process_manager.rb,
# which tries to run a gsub on stdout prematurely breaking the test
@@ -691,7 +691,7 @@ context 'Invoker' do
assert_includes stdout_str, 'Codierungen sind verrückt auf älteren Versionen von Ruby'
end
- test 'should force stdio encoding to UTF-8', unless: jruby_9_1_windows? do
+ test 'should force stdio encoding to UTF-8' do
cmd = asciidoctor_cmd ['-E', 'IBM866:IBM866']
# NOTE configure-stdin.rb populates stdin
result = run_command(cmd, '-r', (fixture_path 'configure-stdin.rb'), '-s', '-o', '-', '-') {|out| out.read }
@@ -702,7 +702,7 @@ context 'Invoker' do
assert_include '<p>IBM866:IBM866</p>', result
end
- test 'should not fail to load if call to Dir.home fails', unless: jruby_9_1_windows? do
+ test 'should not fail to load if call to Dir.home fails' do
cmd = asciidoctor_cmd ['-r', (fixture_path 'undef-dir-home.rb')]
result = run_command(cmd, '-s', '-o', '-', (fixture_path 'basic.adoc')) {|out| out.read }
assert_include 'Body content', result
@@ -721,7 +721,7 @@ context 'Invoker' do
assert_match(/Total time/, error)
end
- test 'should show timezone as UTC if system TZ is set to UTC', unless: jruby_9_1_windows? do
+ test 'should show timezone as UTC if system TZ is set to UTC' do
input_path = fixture_path 'doctime-localtime.adoc'
output = run_command(asciidoctor_cmd, '-d', 'inline', '-o', '-', '-s', input_path, env: { 'TZ' => 'UTC', 'SOURCE_DATE_EPOCH' => nil, 'IGNORE_SOURCE_DATE_EPOCH' => '1' }) {|out| out.read }
doctime, localtime = output.lines.map(&:chomp)
@@ -729,7 +729,7 @@ context 'Invoker' do
assert localtime.end_with?(' UTC')
end
- test 'should show timezone as offset if system TZ is not set to UTC', unless: jruby_9_1_windows? do
+ test 'should show timezone as offset if system TZ is not set to UTC' do
input_path = fixture_path 'doctime-localtime.adoc'
output = run_command(asciidoctor_cmd, '-d', 'inline', '-o', '-', '-s', input_path, env: { 'TZ' => 'EST+5', 'SOURCE_DATE_EPOCH' => nil, 'IGNORE_SOURCE_DATE_EPOCH' => '1' }) {|out| out.read }
doctime, localtime = output.lines.map(&:chomp)
diff --git a/test/test_helper.rb b/test/test_helper.rb
index e95e5069..76f3f795 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -38,6 +38,10 @@ class Minitest::Test
RUBY_ENGINE == 'jruby' && windows? && (JRUBY_VERSION.start_with? '9.1.')
end
+ def jruby_9_1_windows?
+ Minitest::Test.jruby_9_1_windows?
+ end
+
def self.windows?
/mswin|msys|mingw/.match? RbConfig::CONFIG['host_os']
end
@@ -345,7 +349,8 @@ class Minitest::Test
kw_args = Hash === args[-1] ? args.pop : {}
env = kw_args[:env]
(env ||= {})['RUBYOPT'] = nil unless kw_args[:use_bundler]
- opts = { err: [:child, :out] }
+ # JRuby 9.1 on Windows doesn't support popen options; therefore, test cannot capture / assert on stderr
+ opts = jruby_9_1_windows? ? {} : { err: [:child, :out] }
if env
# NOTE while JRuby 9.2.10.0 implements support for unsetenv_others, it doesn't work in child
#if jruby? && (Gem::Version.new JRUBY_VERSION) < (Gem::Version.new '9.2.10.0')