зеркало из https://github.com/github/ruby.git
* test/with_different_ofs.rb (DifferentOFS): should not affect
original classes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
dd5ad24735
Коммит
6d8c13bc61
|
@ -1,3 +1,8 @@
|
|||
Sun Dec 26 11:15:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/with_different_ofs.rb (DifferentOFS): should not affect
|
||||
original classes.
|
||||
|
||||
Sun Dec 26 09:35:07 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* rational.c: parenthesize macro arguments.
|
||||
|
|
|
@ -18,7 +18,7 @@ require_relative "base"
|
|||
# separator <tt>$/</tt>.
|
||||
#
|
||||
class TestCSV::Parsing < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
BIG_DATA = "123456789\n" * 1024
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
require_relative "base"
|
||||
|
||||
class TestCSV::Writing < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
def test_writing
|
||||
[ ["\t", ["\t"]],
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
require_relative "base"
|
||||
|
||||
class TestCSV::DataConverters < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
def setup
|
||||
super
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
require_relative "base"
|
||||
|
||||
class TestCSV::Encodings < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
def setup
|
||||
super
|
||||
|
|
|
@ -12,7 +12,7 @@ require "zlib"
|
|||
require_relative "base"
|
||||
|
||||
class TestCSV::Features < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
TEST_CASES = [ [%Q{a,b}, ["a", "b"]],
|
||||
[%Q{a,"""b"""}, ["a", "\"b\""]],
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
require_relative "base"
|
||||
|
||||
class TestCSV::Headers < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
def setup
|
||||
super
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
require_relative "base"
|
||||
|
||||
class TestCSV::Interface < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
def setup
|
||||
super
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
require_relative "base"
|
||||
|
||||
class TestCSV::Row < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
def setup
|
||||
super
|
||||
|
|
|
@ -25,7 +25,7 @@ class Hash
|
|||
end
|
||||
|
||||
class TestCSV::Serialization < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
### Classes Used to Test Serialization ###
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
require_relative "base"
|
||||
|
||||
class TestCSV::Table < TestCSV
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
def setup
|
||||
super
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'digest'
|
|||
require_relative '../with_different_ofs.rb'
|
||||
|
||||
class TestDigestExtend < Test::Unit::TestCase
|
||||
include DifferentOFS
|
||||
extend DifferentOFS
|
||||
|
||||
class MyDigest < Digest::Class
|
||||
def initialize(*arg)
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
module DifferentOFS
|
||||
def setup
|
||||
super
|
||||
@ofs, $, = $,, "-"
|
||||
end
|
||||
def teardown
|
||||
$, = @ofs
|
||||
super
|
||||
end
|
||||
|
||||
module WithDifferentOFS
|
||||
def with_diffrent_ofs
|
||||
def setup
|
||||
super
|
||||
@ofs, $, = $,, "-"
|
||||
end
|
||||
def teardown
|
||||
$, = @ofs
|
||||
super
|
||||
end
|
||||
end
|
||||
def self.included(klass)
|
||||
|
||||
def self.extended(klass)
|
||||
super(klass)
|
||||
klass.const_set(:DifferentOFS, Class.new(klass).class_eval {include WithDifferentOFS}).name
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче