summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-25 13:08:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-25 13:08:07 +0000
commit7df8b94926b79f280ed0be387897fa3d0187fb44 (patch)
tree5721f9c1d9385a0b4e877263935a8d055f1d66ec
parent36feefecb9db8f66dd228d4cfb3e185679dbdf0d (diff)
downloadruby-7df8b94926b79f280ed0be387897fa3d0187fb44.tar.gz
* test/with_diffent_ofs.rb (DifferentOFS): test suite for test
suites affected by $,. * test/digest/test_digest_extend.rb (TestDigestExtend): should not assume $, invariant. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--test/csv/base.rb17
-rw-r--r--test/digest/test_digest_extend.rb9
-rw-r--r--test/with_diffent_ofs.rb22
4 files changed, 38 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a63b7911d..efe8b5e6ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-Sat Dec 25 22:04:41 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Dec 25 22:08:04 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/with_diffent_ofs.rb (DifferentOFS): test suite for test
+ suites affected by $,.
+
+ * test/digest/test_digest_extend.rb (TestDigestExtend): should not
+ assume $, invariant.
* test/csv/test_data_converters.rb, test/csv/test_table.rb: don't
not call setup within tests.
diff --git a/test/csv/base.rb b/test/csv/base.rb
index 1f83bab4a9..31f949acda 100644
--- a/test/csv/base.rb
+++ b/test/csv/base.rb
@@ -2,19 +2,8 @@ require "test/unit"
require "csv"
-class TestCSV < Test::Unit::TestCase
- module DifferentOFS
- def setup
- super
- @ofs, $, = $,, "-"
- end
- def teardown
- $, = @ofs
- super
- end
- end
+require_relative "../with_diffent_ofs.rb"
- def self.with_diffrent_ofs
- const_set(:DifferentOFS, Class.new(self).class_eval {include DifferentOFS}).name
- end
+class TestCSV < Test::Unit::TestCase
+ include DifferentOFS
end
diff --git a/test/digest/test_digest_extend.rb b/test/digest/test_digest_extend.rb
index 9b8eda03fa..131f90d4c1 100644
--- a/test/digest/test_digest_extend.rb
+++ b/test/digest/test_digest_extend.rb
@@ -1,7 +1,10 @@
require 'test/unit'
require 'digest'
+require_relative '../with_diffent_ofs.rb'
class TestDigestExtend < Test::Unit::TestCase
+ include DifferentOFS
+
class MyDigest < Digest::Class
def initialize(*arg)
super
@@ -20,7 +23,7 @@ class TestDigestExtend < Test::Unit::TestCase
alias << update
def finish
- (@buf.join.length % 256).chr
+ (@buf.join('').length % 256).chr
end
def reset
@@ -39,8 +42,8 @@ class TestDigestExtend < Test::Unit::TestCase
assert_equal('', Digest.hexencode(''))
assert_equal('0102', Digest.hexencode("\1\2"))
assert_equal(
- (0..0xff).to_a.map { |c| sprintf("%02x", c ) }.join,
- Digest.hexencode((0..0xff).to_a.map { |c| c.chr }.join)
+ (0..0xff).to_a.map { |c| sprintf("%02x", c ) }.join(''),
+ Digest.hexencode((0..0xff).to_a.map { |c| c.chr }.join(''))
)
end
diff --git a/test/with_diffent_ofs.rb b/test/with_diffent_ofs.rb
new file mode 100644
index 0000000000..c3f6a4acc7
--- /dev/null
+++ b/test/with_diffent_ofs.rb
@@ -0,0 +1,22 @@
+module DifferentOFS
+ def setup
+ super
+ @ofs, $, = $,, "-"
+ end
+ def teardown
+ $, = @ofs
+ super
+ end
+
+ mod = Module.new do
+ def with_diffrent_ofs
+ const_set(:DifferentOFS, Class.new(self).class_eval {include DifferentOFS}).name
+ end
+ end
+ class << self; self; end.class_eval do
+ define_method(:included) do |klass|
+ super(klass)
+ klass.extend(mod)
+ end
+ end
+end