test/syntax.rb: fix endless def warning (no assertion).
@@ -708,18 +708,27 @@ assert('argument forwarding') do
end
assert('endless def') do
- Class.new do
+ c = Class.new {
def m1 = 42
def m2() = 42
def m3(x) = x+1
def self.s1 = 42
def self.s2() = 42
def self.s3(x) = x + 1
- def c1 = 42
- def cm2() = p 42
- def cm3(x) = p x+1
- def self.cs1 = p 42
- def self.cs2() = p 42
- def self.cs3(x) = p x + 1
- end
+ def cm1 = m3 42
+ def cm2() = m3 42
+ def cm3(x) = m3 x+1
+ def self.cs1 = s3 42
+ def self.cs2() = s3 42
+ def self.cs3(x) = s3 x + 1
+ }
+ o = c.new
+ assert_equal(42, o.m1)
+ assert_equal(43, o.m3(o.m2))
+ assert_equal(42, c.s1)
+ assert_equal(43, c.s3(c.s2))
+ assert_equal(43, o.cm1)
+ assert_equal(45, o.cm3(o.cm2))
+ assert_equal(43, c.cs1)
+ assert_equal(45, c.cs3(c.cs2))
end
