summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-18 13:21:10 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-18 13:21:10 +0000
commit688ec3f8ee114b8c9f477788dd7855355ee11494 (patch)
treebd12f37e20054f075d348f0b672c580dd45c6835
parentebd48363c5b45a5ded4e8c9e8c69bd03fb0eec27 (diff)
* test/*: should not depend on $KCODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--test/ruby/test_alias.rb2
-rw-r--r--test/ruby/test_array.rb2
-rw-r--r--test/ruby/test_assignment.rb2
-rw-r--r--test/ruby/test_bignum.rb2
-rw-r--r--test/ruby/test_call.rb2
-rw-r--r--test/ruby/test_case.rb2
-rw-r--r--test/ruby/test_clone.rb2
-rw-r--r--test/ruby/test_condition.rb2
-rw-r--r--test/ruby/test_const.rb2
-rw-r--r--test/ruby/test_defined.rb2
-rw-r--r--test/ruby/test_env.rb2
-rw-r--r--test/ruby/test_eval.rb2
-rw-r--r--test/ruby/test_exception.rb2
-rw-r--r--test/ruby/test_file.rb2
-rw-r--r--test/ruby/test_float.rb2
-rw-r--r--test/ruby/test_gc.rb2
-rw-r--r--test/ruby/test_hash.rb2
-rw-r--r--test/ruby/test_ifunless.rb2
-rw-r--r--test/ruby/test_iterator.rb2
-rw-r--r--test/ruby/test_marshal.rb2
-rw-r--r--test/ruby/test_math.rb2
-rw-r--r--test/ruby/test_pack.rb2
-rw-r--r--test/ruby/test_path.rb2
-rw-r--r--test/ruby/test_pipe.rb2
-rw-r--r--test/ruby/test_proc.rb2
-rw-r--r--test/ruby/test_range.rb2
-rw-r--r--test/ruby/test_signal.rb2
-rw-r--r--test/ruby/test_stringchar.rb2
-rw-r--r--test/ruby/test_struct.rb2
-rw-r--r--test/ruby/test_system.rb2
-rw-r--r--test/ruby/test_trace.rb2
-rw-r--r--test/ruby/test_variable.rb2
-rw-r--r--test/ruby/test_whileuntil.rb2
-rw-r--r--test/strscan/test_stringscanner.rb44
35 files changed, 32 insertions, 82 deletions
diff --git a/ChangeLog b/ChangeLog
index 9feaf7c587..df24b65c17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Feb 18 22:03:11 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
+
+ * test/*: should not depend on $KCODE.
+
Wed Feb 18 17:18:01 2004 WATANABE Hirofumi <eban@ruby-lang.org>
* ext/win32ole/win32ole.c: need to include <olectl.h> on Cygwin.
diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb
index 50fe452734..83f897fb00 100644
--- a/test/ruby/test_alias.rb
+++ b/test/ruby/test_alias.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestAlias < Test::Unit::TestCase
class Alias0
def foo; "foo" end
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index ed2ee5961c..62582864e3 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestArray < Test::Unit::TestCase
def test_array
assert_equal([1, 2, 3, 4], [1, 2] + [3, 4])
diff --git a/test/ruby/test_assignment.rb b/test/ruby/test_assignment.rb
index 51d1c780f8..63f37a9d73 100644
--- a/test/ruby/test_assignment.rb
+++ b/test/ruby/test_assignment.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestAssignment < Test::Unit::TestCase
def test_assign
a=[]; a[0] ||= "bar";
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index d05bc5406b..c238337db5 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestBignum < Test::Unit::TestCase
def fact(n)
return 1 if n == 0
diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb
index 7694d5196c..da7ee93c73 100644
--- a/test/ruby/test_call.rb
+++ b/test/ruby/test_call.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestCall < Test::Unit::TestCase
def aaa(a, b=100, *rest)
res = [a, b]
diff --git a/test/ruby/test_case.rb b/test/ruby/test_case.rb
index 2407356965..41a22038a0 100644
--- a/test/ruby/test_case.rb
+++ b/test/ruby/test_case.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestCase < Test::Unit::TestCase
def test_case
case 5
diff --git a/test/ruby/test_clone.rb b/test/ruby/test_clone.rb
index 612636c046..43c0cffa1d 100644
--- a/test/ruby/test_clone.rb
+++ b/test/ruby/test_clone.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestClone < Test::Unit::TestCase
module M001; end
module M002; end
diff --git a/test/ruby/test_condition.rb b/test/ruby/test_condition.rb
index 2ef2e0db30..ba2e0688f3 100644
--- a/test/ruby/test_condition.rb
+++ b/test/ruby/test_condition.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestCondition < Test::Unit::TestCase
# [should] first test to see if we can run the tests.
diff --git a/test/ruby/test_const.rb b/test/ruby/test_const.rb
index dfacceb629..8d01379dbd 100644
--- a/test/ruby/test_const.rb
+++ b/test/ruby/test_const.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestConst < Test::Unit::TestCase
TEST1 = 1
TEST2 = 2
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb
index d386b4bddc..8a7fcf45a9 100644
--- a/test/ruby/test_defined.rb
+++ b/test/ruby/test_defined.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestDefined < Test::Unit::TestCase
class Foo
def foo
diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb
index 7d660f05a5..edc7dcaf61 100644
--- a/test/ruby/test_env.rb
+++ b/test/ruby/test_env.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestEnv < Test::Unit::TestCase
IGNORE_CASE = /djgpp|bccwin|mswin|mingw/ =~ RUBY_PLATFORM
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb
index c64741df33..28fd01c70c 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestEval < Test::Unit::TestCase
# eval with binding
def test_ev
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb
index b6abf38c89..4c27c52f3c 100644
--- a/test/ruby/test_exception.rb
+++ b/test/ruby/test_exception.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestException < Test::Unit::TestCase
def test_exception
begin
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb
index 44c315b799..b855bcdc8c 100644
--- a/test/ruby/test_file.rb
+++ b/test/ruby/test_file.rb
@@ -3,8 +3,6 @@ require 'tempfile'
$:.replace([File.dirname(File.expand_path(__FILE__))] | $:)
require 'ut_eof'
-$KCODE = 'none'
-
class TestFile < Test::Unit::TestCase
# I don't know Ruby's spec about "unlink-before-close" exactly.
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index efb69954a1..c18700a575 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestFloat < Test::Unit::TestCase
def test_float
assert_equal(2, 2.6.floor)
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index 5b824309ac..d0b4e3df77 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestGc < Test::Unit::TestCase
class S
def initialize(a)
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index c20f67f573..5bec012bf8 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestHash < Test::Unit::TestCase
def test_hash
x = {1=>2, 2=>4, 3=>6}
diff --git a/test/ruby/test_ifunless.rb b/test/ruby/test_ifunless.rb
index 7910f81b52..bffc794512 100644
--- a/test/ruby/test_ifunless.rb
+++ b/test/ruby/test_ifunless.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestIfunless < Test::Unit::TestCase
def test_if_unless
$x = 'test';
diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb
index c8631653f3..f3c2201e0a 100644
--- a/test/ruby/test_iterator.rb
+++ b/test/ruby/test_iterator.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class Array
def iter_test1
collect{|e| [e, yield(e)]}.sort{|a,b|a[1]<=>b[1]}
diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb
index 2008e3f36a..9c9fd9470b 100644
--- a/test/ruby/test_marshal.rb
+++ b/test/ruby/test_marshal.rb
@@ -8,8 +8,6 @@ ensure
$:.replace(orgpath)
end
-$KCODE = 'none'
-
class TestMarshal < Test::Unit::TestCase
include MarshalTestLib
diff --git a/test/ruby/test_math.rb b/test/ruby/test_math.rb
index c5ddbbdb05..e1e49dba01 100644
--- a/test/ruby/test_math.rb
+++ b/test/ruby/test_math.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestMath < Test::Unit::TestCase
def test_math
assert_equal(2, Math.sqrt(4))
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb
index c7097af423..083111aace 100644
--- a/test/ruby/test_pack.rb
+++ b/test/ruby/test_pack.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestPack < Test::Unit::TestCase
def test_pack
$format = "c2x5CCxsdils_l_a6";
diff --git a/test/ruby/test_path.rb b/test/ruby/test_path.rb
index 55452beb70..95a5d5b1d1 100644
--- a/test/ruby/test_path.rb
+++ b/test/ruby/test_path.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestPath < Test::Unit::TestCase
def test_path
assert_equal("a", File.basename("a"))
diff --git a/test/ruby/test_pipe.rb b/test/ruby/test_pipe.rb
index 03b38635c8..c3b4d29c0a 100644
--- a/test/ruby/test_pipe.rb
+++ b/test/ruby/test_pipe.rb
@@ -3,8 +3,6 @@ $:.replace([File.dirname(File.expand_path(__FILE__))] | $:)
require 'ut_eof'
require 'envutil'
-$KCODE = 'none'
-
class TestPipe < Test::Unit::TestCase
include TestEOF
def open_file(content)
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 23b84ed20f..f0b78ffb23 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestProc < Test::Unit::TestCase
def test_proc
p1 = proc{|i| i}
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index 0b79f5f098..66ed555887 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestRange < Test::Unit::TestCase
def test_range_string
# XXX: Is this really the test of Range?
diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb
index 77c97be98c..d212f9fcc3 100644
--- a/test/ruby/test_signal.rb
+++ b/test/ruby/test_signal.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestSignal < Test::Unit::TestCase
def test_signal
defined?(Process.kill) or return
diff --git a/test/ruby/test_stringchar.rb b/test/ruby/test_stringchar.rb
index e9b643ad3f..943b656510 100644
--- a/test/ruby/test_stringchar.rb
+++ b/test/ruby/test_stringchar.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestStringchar < Test::Unit::TestCase
def test_string
assert_equal("abcd", "abcd")
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb
index 4a57537d37..fa1bb1549a 100644
--- a/test/ruby/test_struct.rb
+++ b/test/ruby/test_struct.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestStruct < Test::Unit::TestCase
def test_struct
struct_test = Struct.new("Test", :foo, :bar)
diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb
index a19f6ef9b7..f3a71598f7 100644
--- a/test/ruby/test_system.rb
+++ b/test/ruby/test_system.rb
@@ -2,8 +2,6 @@ require 'test/unit'
$:.replace([File.dirname(File.expand_path(__FILE__))] | $:)
require 'envutil'
-$KCODE = 'none'
-
class TestSystem < Test::Unit::TestCase
def valid_syntax?(code, fname)
eval("BEGIN {return true}\n#{code}", nil, fname, 0)
diff --git a/test/ruby/test_trace.rb b/test/ruby/test_trace.rb
index 69c0c24fe7..6adfe0bf64 100644
--- a/test/ruby/test_trace.rb
+++ b/test/ruby/test_trace.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestTrace < Test::Unit::TestCase
def test_trace
$x = 1234
diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb
index ab0e405115..8726160826 100644
--- a/test/ruby/test_variable.rb
+++ b/test/ruby/test_variable.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestVariable < Test::Unit::TestCase
class Gods
@@rule = "Uranus"
diff --git a/test/ruby/test_whileuntil.rb b/test/ruby/test_whileuntil.rb
index 841a15135d..6faed31160 100644
--- a/test/ruby/test_whileuntil.rb
+++ b/test/ruby/test_whileuntil.rb
@@ -1,7 +1,5 @@
require 'test/unit'
-$KCODE = 'none'
-
class TestWhileuntil < Test::Unit::TestCase
def test_while
tmp = open("while_tmp", "w")
diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb
index b9f7f7ddae..72961efd68 100644
--- a/test/strscan/test_stringscanner.rb
+++ b/test/strscan/test_stringscanner.rb
@@ -240,11 +240,15 @@ class TestStringScanner < Test::Unit::TestCase
assert_equal true, s.getch.tainted?
assert_nil s.getch
- $KCODE = 'EUC'
- s = StringScanner.new("\244\242")
- assert_equal "\244\242", s.getch
- assert_nil s.getch
- $KCODE = 'NONE'
+ kc_backup = $KCODE
+ begin
+ $KCODE = 'EUC'
+ s = StringScanner.new("\244\242")
+ assert_equal "\244\242", s.getch
+ assert_nil s.getch
+ ensure
+ $KCODE = kc_backup
+ end
s = StringScanner.new('test')
s.scan(/te/)
@@ -270,12 +274,16 @@ class TestStringScanner < Test::Unit::TestCase
assert_equal true, s.get_byte.tainted?
assert_nil s.get_byte
- $KCODE = 'EUC'
- s = StringScanner.new("\244\242")
- assert_equal "\244", s.get_byte
- assert_equal "\242", s.get_byte
- assert_nil s.get_byte
- $KCODE = 'NONE'
+ kc_backup = $KCODE
+ begin
+ $KCODE = 'EUC'
+ s = StringScanner.new("\244\242")
+ assert_equal "\244", s.get_byte
+ assert_equal "\242", s.get_byte
+ assert_nil s.get_byte
+ ensure
+ $KCODE = kc_backup
+ end
s = StringScanner.new('test')
s.scan(/te/)
@@ -368,11 +376,15 @@ class TestStringScanner < Test::Unit::TestCase
assert_nil s[0]
- $KCODE = 'EUC'
- s = StringScanner.new("\244\242")
- s.getch
- assert_equal "\244\242", s[0]
- $KCODE = 'NONE'
+ kc_backup = $KCODE
+ begin
+ $KCODE = 'EUC'
+ s = StringScanner.new("\244\242")
+ s.getch
+ assert_equal "\244\242", s[0]
+ ensure
+ $KCODE = kc_backup
+ end
str = 'test'