mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
dd5ad24735
commit
6d8c13bc61
13 changed files with 25 additions and 22 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue