1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/*: should not depend on $KCODE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nahi 2004-02-18 13:08:08 +00:00
parent 44284f71c9
commit 994dfc0ae6
36 changed files with 32 additions and 84 deletions

View file

@ -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 18:07:09 2004 NAKAMURA Usaku <usa@ruby-lang.org> Wed Feb 18 18:07:09 2004 NAKAMURA Usaku <usa@ruby-lang.org>
* test/ruby/test_sprintf.rb: added tests. * test/ruby/test_sprintf.rb: added tests.

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestAlias < Test::Unit::TestCase class TestAlias < Test::Unit::TestCase
class Alias0 class Alias0
def foo; "foo" end def foo; "foo" end

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestArray < Test::Unit::TestCase class TestArray < Test::Unit::TestCase
def test_array def test_array
assert_equal([1, 2, 3, 4], [1, 2] + [3, 4]) assert_equal([1, 2, 3, 4], [1, 2] + [3, 4])

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestAssignment < Test::Unit::TestCase class TestAssignment < Test::Unit::TestCase
def test_assign def test_assign
a=[]; a[0] ||= "bar"; a=[]; a[0] ||= "bar";

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestBignum < Test::Unit::TestCase class TestBignum < Test::Unit::TestCase
def fact(n) def fact(n)
return 1 if n == 0 return 1 if n == 0

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestCall < Test::Unit::TestCase class TestCall < Test::Unit::TestCase
def aaa(a, b=100, *rest) def aaa(a, b=100, *rest)
res = [a, b] res = [a, b]

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestCase < Test::Unit::TestCase class TestCase < Test::Unit::TestCase
def test_case def test_case
case 5 case 5

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestClone < Test::Unit::TestCase class TestClone < Test::Unit::TestCase
module M001; end module M001; end
module M002; end module M002; end

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestCondition < Test::Unit::TestCase class TestCondition < Test::Unit::TestCase
# [should] first test to see if we can run the tests. # [should] first test to see if we can run the tests.

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestConst < Test::Unit::TestCase class TestConst < Test::Unit::TestCase
TEST1 = 1 TEST1 = 1
TEST2 = 2 TEST2 = 2

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestDefined < Test::Unit::TestCase class TestDefined < Test::Unit::TestCase
class Foo class Foo
def foo def foo

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestEnv < Test::Unit::TestCase class TestEnv < Test::Unit::TestCase
IGNORE_CASE = /djgpp|bccwin|mswin|mingw/ =~ RUBY_PLATFORM IGNORE_CASE = /djgpp|bccwin|mswin|mingw/ =~ RUBY_PLATFORM

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestEval < Test::Unit::TestCase class TestEval < Test::Unit::TestCase
# eval with binding # eval with binding
def test_ev def test_ev

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestException < Test::Unit::TestCase class TestException < Test::Unit::TestCase
def test_exception def test_exception
begin begin

View file

@ -2,8 +2,6 @@ require 'test/unit'
require 'tempfile' require 'tempfile'
require 'ut_eof' require 'ut_eof'
$KCODE = 'none'
class TestFile < Test::Unit::TestCase class TestFile < Test::Unit::TestCase
# I don't know Ruby's spec about "unlink-before-close" exactly. # I don't know Ruby's spec about "unlink-before-close" exactly.

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestFloat < Test::Unit::TestCase class TestFloat < Test::Unit::TestCase
def test_float def test_float
assert_equal(2, 2.6.floor) assert_equal(2, 2.6.floor)

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestGc < Test::Unit::TestCase class TestGc < Test::Unit::TestCase
class S class S
def initialize(a) def initialize(a)

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestHash < Test::Unit::TestCase class TestHash < Test::Unit::TestCase
def test_hash def test_hash
x = {1=>2, 2=>4, 3=>6} x = {1=>2, 2=>4, 3=>6}

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestIfunless < Test::Unit::TestCase class TestIfunless < Test::Unit::TestCase
def test_if_unless def test_if_unless
$x = 'test'; $x = 'test';

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class Array class Array
def iter_test1 def iter_test1
collect{|e| [e, yield(e)]}.sort{|a,b|a[1]<=>b[1]} collect{|e| [e, yield(e)]}.sort{|a,b|a[1]<=>b[1]}

View file

@ -8,8 +8,6 @@ ensure
$:.replace(orgpath) $:.replace(orgpath)
end end
$KCODE = 'none'
class TestMarshal < Test::Unit::TestCase class TestMarshal < Test::Unit::TestCase
include MarshalTestLib include MarshalTestLib

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestMath < Test::Unit::TestCase class TestMath < Test::Unit::TestCase
def test_math def test_math
assert_equal(2, Math.sqrt(4)) assert_equal(2, Math.sqrt(4))

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestPack < Test::Unit::TestCase class TestPack < Test::Unit::TestCase
def test_pack def test_pack
$format = "c2x5CCxsdils_l_a6"; $format = "c2x5CCxsdils_l_a6";

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestPath < Test::Unit::TestCase class TestPath < Test::Unit::TestCase
def test_path def test_path
assert_equal("a", File.basename("a")) assert_equal("a", File.basename("a"))

View file

@ -2,8 +2,6 @@ require 'test/unit'
require 'ut_eof' require 'ut_eof'
require 'envutil' require 'envutil'
$KCODE = 'none'
class TestPipe < Test::Unit::TestCase class TestPipe < Test::Unit::TestCase
include TestEOF include TestEOF
def open_file(content) def open_file(content)

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestProc < Test::Unit::TestCase class TestProc < Test::Unit::TestCase
def test_proc def test_proc
p1 = proc{|i| i} p1 = proc{|i| i}

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestRange < Test::Unit::TestCase class TestRange < Test::Unit::TestCase
def test_range_string def test_range_string
# XXX: Is this really the test of Range? # XXX: Is this really the test of Range?

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestSignal < Test::Unit::TestCase class TestSignal < Test::Unit::TestCase
def test_signal def test_signal
defined?(Process.kill) or return defined?(Process.kill) or return

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestSprintf < Test::Unit::TestCase class TestSprintf < Test::Unit::TestCase
def test_binary def test_binary
assert_equal("0", sprintf("%b", 0)) assert_equal("0", sprintf("%b", 0))

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestStringchar < Test::Unit::TestCase class TestStringchar < Test::Unit::TestCase
def test_string def test_string
assert_equal("abcd", "abcd") assert_equal("abcd", "abcd")

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestStruct < Test::Unit::TestCase class TestStruct < Test::Unit::TestCase
def test_struct def test_struct
struct_test = Struct.new("Test", :foo, :bar) struct_test = Struct.new("Test", :foo, :bar)

View file

@ -1,8 +1,6 @@
require 'test/unit' require 'test/unit'
require 'envutil' require 'envutil'
$KCODE = 'none'
class TestSystem < Test::Unit::TestCase class TestSystem < Test::Unit::TestCase
def valid_syntax?(code, fname) def valid_syntax?(code, fname)
eval("BEGIN {return true}\n#{code}", nil, fname, 0) eval("BEGIN {return true}\n#{code}", nil, fname, 0)

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestTrace < Test::Unit::TestCase class TestTrace < Test::Unit::TestCase
def test_trace def test_trace
$x = 1234 $x = 1234

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestVariable < Test::Unit::TestCase class TestVariable < Test::Unit::TestCase
class Gods class Gods
@@rule = "Uranus" @@rule = "Uranus"

View file

@ -1,7 +1,5 @@
require 'test/unit' require 'test/unit'
$KCODE = 'none'
class TestWhileuntil < Test::Unit::TestCase class TestWhileuntil < Test::Unit::TestCase
def test_while def test_while
tmp = open("while_tmp", "w") tmp = open("while_tmp", "w")

View file

@ -240,11 +240,15 @@ class TestStringScanner < Test::Unit::TestCase
assert_equal true, s.getch.tainted? assert_equal true, s.getch.tainted?
assert_nil s.getch assert_nil s.getch
$KCODE = 'EUC' kc_backup = $KCODE
s = StringScanner.new("\244\242") begin
assert_equal "\244\242", s.getch $KCODE = 'EUC'
assert_nil s.getch s = StringScanner.new("\244\242")
$KCODE = 'NONE' assert_equal "\244\242", s.getch
assert_nil s.getch
ensure
$KCODE = kc_backup
end
s = StringScanner.new('test') s = StringScanner.new('test')
s.scan(/te/) s.scan(/te/)
@ -270,12 +274,16 @@ class TestStringScanner < Test::Unit::TestCase
assert_equal true, s.get_byte.tainted? assert_equal true, s.get_byte.tainted?
assert_nil s.get_byte assert_nil s.get_byte
$KCODE = 'EUC' kc_backup = $KCODE
s = StringScanner.new("\244\242") begin
assert_equal "\244", s.get_byte $KCODE = 'EUC'
assert_equal "\242", s.get_byte s = StringScanner.new("\244\242")
assert_nil s.get_byte assert_equal "\244", s.get_byte
$KCODE = 'NONE' assert_equal "\242", s.get_byte
assert_nil s.get_byte
ensure
$KCODE = kc_backup
end
s = StringScanner.new('test') s = StringScanner.new('test')
s.scan(/te/) s.scan(/te/)
@ -368,11 +376,15 @@ class TestStringScanner < Test::Unit::TestCase
assert_nil s[0] assert_nil s[0]
$KCODE = 'EUC' kc_backup = $KCODE
s = StringScanner.new("\244\242") begin
s.getch $KCODE = 'EUC'
assert_equal "\244\242", s[0] s = StringScanner.new("\244\242")
$KCODE = 'NONE' s.getch
assert_equal "\244\242", s[0]
ensure
$KCODE = kc_backup
end
str = 'test' str = 'test'