summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_dir_m17n.rb4
-rw-r--r--test/ruby/test_m17n.rb4
-rw-r--r--test/ruby/test_m17n_comb.rb2
-rw-r--r--test/ruby/test_range.rb34
4 files changed, 26 insertions, 18 deletions
diff --git a/test/ruby/test_dir_m17n.rb b/test/ruby/test_dir_m17n.rb
index 59feb2b089..fb37fe1342 100644
--- a/test/ruby/test_dir_m17n.rb
+++ b/test/ruby/test_dir_m17n.rb
@@ -67,7 +67,7 @@ class TestDir_M17N < Test::Unit::TestCase
s2 = File.stat(filename2) rescue nil
s3 = File.stat(filename3) rescue nil
s4 = File.stat(filename4) rescue nil
- exit (s1 && s2 && !s3 && !s4) ? true : false
+ exit((s1 && s2 && !s3 && !s4) ? true : false)
EOS
}
end
@@ -122,7 +122,7 @@ class TestDir_M17N < Test::Unit::TestCase
s1 = File.stat(filename1) rescue nil
s2 = File.stat(filename2) rescue nil
s3 = File.stat(filename3) rescue nil
- exit (s1 && s2 && s3) ? true : false
+ exit((s1 && s2 && s3) ? true : false)
EOS
}
end
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 0911a7378c..cb60e0fa76 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1218,8 +1218,8 @@ class TestM17N < Test::Unit::TestCase
assert_equal(Encoding::US_ASCII, eval("\n# -*- encoding: ASCII-8BIT -*-\n__ENCODING__".force_encoding("US-ASCII")))
# leading expressions
- assert_equal(Encoding::ASCII_8BIT, eval("1+1 # -*- encoding: US-ASCII -*-\n__ENCODING__".force_encoding("ASCII-8BIT")))
- assert_equal(Encoding::US_ASCII, eval("1+1 # -*- encoding: ASCII-8BIT -*-\n__ENCODING__".force_encoding("US-ASCII")))
+ assert_equal(Encoding::ASCII_8BIT, eval("v=1 # -*- encoding: US-ASCII -*-\n__ENCODING__".force_encoding("ASCII-8BIT")))
+ assert_equal(Encoding::US_ASCII, eval("v=1 # -*- encoding: ASCII-8BIT -*-\n__ENCODING__".force_encoding("US-ASCII")))
end
def test_regexp_usascii
diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb
index 57a8b16dfa..ab891363b1 100644
--- a/test/ruby/test_m17n_comb.rb
+++ b/test/ruby/test_m17n_comb.rb
@@ -1057,7 +1057,7 @@ class TestM17NComb < Test::Unit::TestCase
def test_str_oct
STRINGS.each {|s|
t = s.oct
- t2 = a(s)[/\A[0-9a-fA-FxXbB]*/].oct
+ t2 = a(s)[/\A[0-9a-fA-FxX]*/].oct
assert_equal(t2, t)
}
end
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index e0ff273836..a2935955de 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -189,8 +189,12 @@ class TestRange < Test::Unit::TestCase
o1 = Object.new
o2 = Object.new
- def o1.<=>(x); -1; end
- def o2.<=>(x); 0; end
+ def o1.setcmp(v) @cmpresult = v end
+ o1.setcmp(-1)
+ def o1.<=>(x); @cmpresult; end
+ def o2.setcmp(v) @cmpresult = v end
+ o2.setcmp(0)
+ def o2.<=>(x); @cmpresult; end
class << o1; self; end.class_eval do
define_method(:succ) { o2 }
end
@@ -206,19 +210,19 @@ class TestRange < Test::Unit::TestCase
r2.each {|x| a << x }
assert_equal([o1], a)
- def o2.<=>(x); 1; end
+ o2.setcmp(1)
a = []
r1.each {|x| a << x }
assert_equal([o1], a)
- def o2.<=>(x); nil; end
+ o2.setcmp(nil)
a = []
r1.each {|x| a << x }
assert_equal([o1], a)
- def o1.<=>(x); nil; end
+ o1.setcmp(nil)
a = []
r2.each {|x| a << x }
@@ -270,20 +274,24 @@ class TestRange < Test::Unit::TestCase
def test_beg_len
o = Object.new
assert_raise(TypeError) { [][o] }
- def o.begin; -10; end
+ class << o; attr_accessor :begin end
+ o.begin = -10
assert_raise(TypeError) { [][o] }
- def o.end; 0; end
+ class << o; attr_accessor :end end
+ o.end = 0
assert_raise(NoMethodError) { [][o] }
- def o.exclude_end?; false; end
+ def o.exclude_end=(v) @exclude_end = v end
+ def o.exclude_end?() @exclude_end end
+ o.exclude_end = false
assert_nil([0][o])
assert_raise(RangeError) { [0][o] = 1 }
- def o.begin; 10; end
- def o.end; 10; end
+ o.begin = 10
+ o.end = 10
assert_nil([0][o])
- def o.begin; 0; end
+ o.begin = 0
assert_equal([0], [0][o])
- def o.begin; 2; end
- def o.end; 0; end
+ o.begin = 2
+ o.end = 0
assert_equal([], [0, 1, 2][o])
end