about summary refs log tree commit homepage
path: root/test/unit/test_util.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/test_util.rb')
-rw-r--r--test/unit/test_util.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb
index 9d5d4ef..ce53b86 100644
--- a/test/unit/test_util.rb
+++ b/test/unit/test_util.rb
@@ -1,4 +1,5 @@
 # -*- encoding: binary -*-
+# frozen_string_literal: false
 
 require './test/test_helper'
 require 'tempfile'
@@ -51,7 +52,7 @@ class TestUtil < Test::Unit::TestCase
   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 +75,9 @@ class TestUtil < Test::Unit::TestCase
   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
@@ -114,7 +116,7 @@ class TestUtil < Test::Unit::TestCase
       f_getpipe_sz = 1032
       IO.pipe do |a, b|
         a_sz = a.fcntl(f_getpipe_sz)
-        b_sz = b.fcntl(f_getpipe_sz)
+        b.fcntl(f_getpipe_sz)
         assert_kind_of Integer, a_sz
         r_sz = r.fcntl(f_getpipe_sz)
         assert_equal Raindrops::PAGE_SIZE, r_sz