From 6554cabddd664228066dad67efed8f5b87bab2e0 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Thu, 14 Nov 2024 11:20:13 +0100 Subject: [PATCH] Improve encoding test --- test/engines/test_encoding.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/engines/test_encoding.rb b/test/engines/test_encoding.rb index bbc84e1..94f63ef 100644 --- a/test/engines/test_encoding.rb +++ b/test/engines/test_encoding.rb @@ -1,13 +1,18 @@ -require 'minitest/autorun' +require "minitest/autorun" 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