Skip to content

Commit d6ca71d

Browse files
authored
Merge pull request #8626 from joshcooper/ruby3_windows_encoding_11049
(PUP-11049) Update external encoding tests on Windows for Ruby 3
2 parents 46e4ec1 + 8412f5a commit d6ca71d

File tree

4 files changed

+3
-16
lines changed

4 files changed

+3
-16
lines changed

.github/workflows/rspec_tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ jobs:
1616
- {os: ubuntu-18.04, ruby: 2.5}
1717
- {os: ubuntu-18.04, ruby: 2.6}
1818
- {os: ubuntu-18.04, ruby: 2.7}
19+
- {os: ubuntu-18.04, ruby: 3.0}
1920
- {os: ubuntu-18.04, ruby: jruby-9.2.9.0}
2021
- {os: windows-2016, ruby: 2.5}
2122
- {os: windows-2016, ruby: 2.6}
2223
- {os: windows-2016, ruby: 2.7}
24+
- {os: windows-2016, ruby: 3.0}
2325

2426
runs-on: ${{ matrix.cfg.os }}
2527
steps:

spec/unit/pops/loaders/dependency_loader_spec.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ def foo
8484

8585
context 'when loading files from disk' do
8686
it 'should always read files as UTF-8' do
87-
if Puppet::Util::Platform.windows? && Encoding.default_external == Encoding::UTF_8
88-
raise 'This test must be run in a codepage other than 65001 to validate behavior'
89-
end
90-
9187
module_dir = dir_containing('testmodule', {
9288
'lib' => { 'puppet' => { 'functions' => { 'testmodule' => {
9389
'foo.rb' => code_utf8
@@ -101,11 +97,6 @@ def foo
10197

10298
it 'currently ignores the UTF-8 BOM (Byte Order Mark) when loading module files' do
10399
bom = "\uFEFF"
104-
105-
if Puppet::Util::Platform.windows? && Encoding.default_external == Encoding::UTF_8
106-
raise 'This test must be run in a codepage other than 65001 to validate behavior'
107-
end
108-
109100
module_dir = dir_containing('testmodule', {
110101
'lib' => { 'puppet' => { 'functions' => { 'testmodule' => {
111102
'foo.rb' => "#{bom}#{code_utf8}"

spec/unit/pops/parser/lexer2_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -918,10 +918,6 @@ def expect_issue(code, issue)
918918

919919
context 'when lexing files from disk' do
920920
it 'should always read files as UTF-8' do
921-
if Puppet::Util::Platform.windows? && Encoding.default_external == Encoding::UTF_8
922-
raise 'This test must be run in a codepage other than 65001 to validate behavior'
923-
end
924-
925921
manifest_code = "notify { '#{rune_utf8}': }"
926922
manifest = file_containing('manifest.pp', manifest_code)
927923
lexed_file = described_class.new.lex_file(manifest)

spec/unit/util_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ def withenv_utf8(&block)
142142

143143
# In 2.3, the behavior is mostly correct when external codepage is 65001 / UTF-8
144144
it "works around Ruby bug 8822 (which fails to preserve UTF-8 properly when accessing ENV) (Ruby >= 2.3.x) ",
145-
:if => Puppet::Util::Platform.windows? do
146-
147-
raise 'This test requires a non-UTF8 codepage' if Encoding.default_external == Encoding::UTF_8
145+
:if => Puppet::Util::Platform.windows? && RUBY_VERSION.to_f < 3 do
148146

149147
withenv_utf8 do |utf_8_key, utf_8_value, codepage_key|
150148
# Ruby 2.3 fixes access by the original UTF-8 key, and behaves differently than 2.1

0 commit comments

Comments
 (0)