From: Eric Wong <bofh@yhbt.net>
To: unicorn-public@yhbt.net
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH] test_util: less excessive encoding tests
Date: Fri, 30 Apr 2021 18:17:33 +0000 [thread overview]
Message-ID: <20210430181733.29083-1-bofh@yhbt.net> (raw)
From: Eric Wong <e@80x24.org>
Ruby's handling of encodings hasn't changed much in over
a decade and these tests haven't failed for me since August 2013:
https://yhbt.net/unicorn-public/9af083d7f6b97c0f5ebbdd9a42b58478a6f874b7/s/
So lets take a small step in reducing energy consumption
and save potential developers over 10s of CPU time.
---
test/unit/test_util.rb | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb
index 4a820ea..bc7b233 100644
--- a/test/unit/test_util.rb
+++ b/test/unit/test_util.rb
@@ -51,7 +51,7 @@ def test_reopen_logs_renamed
def test_reopen_logs_renamed_with_encoding
tmp = Tempfile.new('')
tmp_path = tmp.path.dup.freeze
- Encoding.list.each { |encoding|
+ Encoding.list.sample(5).each { |encoding|
File.open(tmp_path, "a:#{encoding.to_s}") { |fp|
fp.sync = true
assert_equal encoding, fp.external_encoding
@@ -74,8 +74,9 @@ def test_reopen_logs_renamed_with_encoding
def test_reopen_logs_renamed_with_internal_encoding
tmp = Tempfile.new('')
tmp_path = tmp.path.dup.freeze
- Encoding.list.each { |ext|
- Encoding.list.each { |int|
+ full = Encoding.list
+ full.sample(2).each { |ext|
+ full.sample(2).each { |int|
next if ext == int
File.open(tmp_path, "a:#{ext.to_s}:#{int.to_s}") { |fp|
fp.sync = true
reply other threads:[~2021-04-30 18:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210430181733.29083-1-bofh@yhbt.net \
--to=bofh@yhbt.net \
--cc=e@80x24.org \
--cc=unicorn-public@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
http://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).