Skip to content

Commit

Permalink
Merge pull request #12 from DataDog/lloeki/improve-test
Browse files Browse the repository at this point in the history
Improve encoding test
  • Loading branch information
lloeki authored Nov 20, 2024
2 parents 5dfc960 + a700aa5 commit 52d10e3
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/engines/ruby/2.1/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/2.2/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/2.3/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/2.4/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/2.5/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/2.6/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/2.7/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/3.0/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/3.1/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/3.2/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/3.3/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/engines/ruby/3.4/Dockerfile.musl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 20 additions & 6 deletions test/engines/test_encoding.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 52d10e3

Please sign in to comment.