[前][次][番号順一覧][スレッド一覧]

ruby-changes:60419

From: Nobuyoshi <ko1@a...>
Date: Sun, 15 Mar 2020 22:15:57 +0900 (JST)
Subject: [ruby-changes:60419] 1ad9b231ca (master): Added guard against [Bug #16497]

https://git.ruby-lang.org/ruby.git/commit/?id=1ad9b231ca

From 1ad9b231ca6b86fe6a2f186022ad3854d2c31743 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 15 Mar 2020 22:15:39 +0900
Subject: Added guard against [Bug #16497]


diff --git a/spec/ruby/library/stringio/initialize_spec.rb b/spec/ruby/library/stringio/initialize_spec.rb
index 8aae47d..5900313 100644
--- a/spec/ruby/library/stringio/initialize_spec.rb
+++ b/spec/ruby/library/stringio/initialize_spec.rb
@@ -1,6 +1,26 @@ https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/initialize_spec.rb#L1
 require_relative '../../spec_helper'
 require 'stringio'
 
+bug_guard = Class.new(VersionGuard) do
+  VERSION = StringIO.const_defined?(:VERSION) ? StringIO::VERSION : "0.0.2"
+  def initialize(bug, version)
+    @bug = bug
+    super(version)
+    @parameters = [bug, version]
+  end
+  def match?
+    if Range === @version
+      @version.include? VERSION
+    else
+      VERSION >= @version
+    end
+  end
+
+  def self.against(*args, &block)
+    new(*args).run_unless(:stringio_version_is, &block)
+  end
+end
+
 describe "StringIO#initialize when passed [Object, mode]" do
   before :each do
     @io = StringIO.allocate
@@ -206,7 +226,9 @@ describe "StringIO#initialize sets the encoding to" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/library/stringio/initialize_spec.rb#L226
   it "the same as the encoding of the String when passed a String" do
     s = ''.force_encoding(Encoding::EUC_JP)
     io = StringIO.new(s)
-    io.external_encoding.should == Encoding::EUC_JP
+    bug_guard.against("[Bug #16497]", "0.0.3"..."0.1.1") do
+      io.external_encoding.should == Encoding::EUC_JP
+    end
     io.string.encoding.should == Encoding::EUC_JP
   end
 end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]