From 0d8de8955877a4325ff63b1a9a90cbf171b527cc Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Wed, 20 Nov 2024 11:51:57 +0100 Subject: [PATCH 1/2] Improve encoding test --- test/engines/test_encoding.rb | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/test/engines/test_encoding.rb b/test/engines/test_encoding.rb index bbc84e1..92ab0bf 100644 --- a/test/engines/test_encoding.rb +++ b/test/engines/test_encoding.rb @@ -1,13 +1,27 @@ -require 'minitest/autorun' +require "minitest/autorun" + +# polyfill for Ruby 2.2 and down, used by minitest +unless "".respond_to?(:match?) + String.instance_eval do + def match?(other) + (Regexp === other) ? other.match?(self) : (self == other) + end + end +end class TestEncoding < Minitest::Test - def test_utf8 - assert_equal("".encoding, Encoding::UTF_8) + def test_utf8_lang + assert_equal("en_US.UTF-8", ENV["LANG"]) + end + + def test_utf8_string + assert_equal(Encoding::UTF_8, "".encoding) end def test_read_utf8 - contents = File.read('test/fixtures/encoding/utf-8.txt') - assert_equal(contents.encoding, Encoding::UTF_8) - assert_equal(contents, "\u2705\n") + contents = File.read("test/fixtures/encoding/utf-8.txt") + + assert_equal(Encoding::UTF_8, contents.encoding) + assert_equal("\u2705\n", contents) end end From a700aa5f8f3548ee2f880160d6967d80bdb1c3b4 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Wed, 20 Nov 2024 11:52:29 +0100 Subject: [PATCH 2/2] Make musl conformant --- src/engines/ruby/2.1/Dockerfile.musl | 2 ++ src/engines/ruby/2.2/Dockerfile.musl | 2 ++ src/engines/ruby/2.3/Dockerfile.musl | 2 ++ src/engines/ruby/2.4/Dockerfile.musl | 2 ++ src/engines/ruby/2.5/Dockerfile.musl | 2 ++ src/engines/ruby/2.6/Dockerfile.musl | 2 ++ src/engines/ruby/2.7/Dockerfile.musl | 2 ++ src/engines/ruby/3.0/Dockerfile.musl | 2 ++ src/engines/ruby/3.1/Dockerfile.musl | 2 ++ src/engines/ruby/3.2/Dockerfile.musl | 2 ++ src/engines/ruby/3.3/Dockerfile.musl | 2 ++ src/engines/ruby/3.4/Dockerfile.musl | 2 ++ 12 files changed, 24 insertions(+) diff --git a/src/engines/ruby/2.1/Dockerfile.musl b/src/engines/ruby/2.1/Dockerfile.musl index 72a8779..7212121 100644 --- a/src/engines/ruby/2.1/Dockerfile.musl +++ b/src/engines/ruby/2.1/Dockerfile.musl @@ -29,6 +29,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 2.7.11 RUN gem install bundler --version 1.17.3 diff --git a/src/engines/ruby/2.2/Dockerfile.musl b/src/engines/ruby/2.2/Dockerfile.musl index be263cd..1356c52 100644 --- a/src/engines/ruby/2.2/Dockerfile.musl +++ b/src/engines/ruby/2.2/Dockerfile.musl @@ -29,6 +29,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 2.7.11 RUN gem install bundler --version 1.17.3 diff --git a/src/engines/ruby/2.3/Dockerfile.musl b/src/engines/ruby/2.3/Dockerfile.musl index 0aadd04..dd8989c 100644 --- a/src/engines/ruby/2.3/Dockerfile.musl +++ b/src/engines/ruby/2.3/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.3.26 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/2.4/Dockerfile.musl b/src/engines/ruby/2.4/Dockerfile.musl index ee2da59..aac98b8 100644 --- a/src/engines/ruby/2.4/Dockerfile.musl +++ b/src/engines/ruby/2.4/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.3.26 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/2.5/Dockerfile.musl b/src/engines/ruby/2.5/Dockerfile.musl index 8edb08f..7021c7d 100644 --- a/src/engines/ruby/2.5/Dockerfile.musl +++ b/src/engines/ruby/2.5/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.3.26 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/2.6/Dockerfile.musl b/src/engines/ruby/2.6/Dockerfile.musl index f5856bd..98462c3 100644 --- a/src/engines/ruby/2.6/Dockerfile.musl +++ b/src/engines/ruby/2.6/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.3.26 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/2.7/Dockerfile.musl b/src/engines/ruby/2.7/Dockerfile.musl index 7521b59..1822987 100644 --- a/src/engines/ruby/2.7/Dockerfile.musl +++ b/src/engines/ruby/2.7/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.3.26 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/3.0/Dockerfile.musl b/src/engines/ruby/3.0/Dockerfile.musl index 3a87a09..847fcff 100644 --- a/src/engines/ruby/3.0/Dockerfile.musl +++ b/src/engines/ruby/3.0/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.5.21 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/3.1/Dockerfile.musl b/src/engines/ruby/3.1/Dockerfile.musl index 5f248f1..2ff39c7 100644 --- a/src/engines/ruby/3.1/Dockerfile.musl +++ b/src/engines/ruby/3.1/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.5.21 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/3.2/Dockerfile.musl b/src/engines/ruby/3.2/Dockerfile.musl index f370a7b..98f836b 100644 --- a/src/engines/ruby/3.2/Dockerfile.musl +++ b/src/engines/ruby/3.2/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.5.21 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/3.3/Dockerfile.musl b/src/engines/ruby/3.3/Dockerfile.musl index 9fe7520..fce5674 100644 --- a/src/engines/ruby/3.3/Dockerfile.musl +++ b/src/engines/ruby/3.3/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.5.21 RUN gem install bundler:2.3.26 diff --git a/src/engines/ruby/3.4/Dockerfile.musl b/src/engines/ruby/3.4/Dockerfile.musl index 81c4e08..592f869 100644 --- a/src/engines/ruby/3.4/Dockerfile.musl +++ b/src/engines/ruby/3.4/Dockerfile.musl @@ -28,6 +28,8 @@ ARG REPRO_RUN_KEY=0 # updated by changing the `REPRO_RUN_KEY`. RUN true "${REPRO_RUN_KEY}" && apk update +ENV LANG en_US.UTF-8 + ## Install a pinned RubyGems and Bundler RUN gem update --system 3.5.21 RUN gem install bundler:2.3.26