diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-02-13 09:01:11 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-02-13 09:01:11 +0000 |
| commit | 97a7ce88a52e0ca85c48e6e791ca8714ee32301a (patch) | |
| tree | e744db6e8f1628411bd65782f6fd1c516aea47b7 /sample | |
| parent | a33e6f4c60520e64739b1557d6a685414c097e38 (diff) | |
| download | ruby-97a7ce88a52e0ca85c48e6e791ca8714ee32301a.tar.gz ruby-97a7ce88a52e0ca85c48e6e791ca8714ee32301a.tar.xz ruby-97a7ce88a52e0ca85c48e6e791ca8714ee32301a.zip | |
* parse.y (stmt): local variable declaration order was changed
since 1.6
* parse.y (arg): ditto.
* pack.c (pack_pack): add templates 'q' and 'Q'.
* pack.c (pack_unpack): ditto.
* bignum.c (rb_quad_pack): new utility function.
* bignum.c (rb_quad_unpack): ditto.
* parse.y (assignable): should emit CVASGN within the method
body.
* dir.c (dir_s_glob): should not warn even if no match found.
* eval.c (rb_eval): clean up class variable behavior.
* eval.c (assign): ditto.
* eval.c (is_defined): ditto.
* variable.c (rb_mod_class_variables): need not to call rb_cvar_singleton().
* variable.c (rb_cvar_singleton): removed.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
| -rw-r--r-- | sample/test.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sample/test.rb b/sample/test.rb index fc2eb5ae0..d3773fe68 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1288,6 +1288,43 @@ foobar = "foobar" $_ = foobar test_ok($_ == foobar) +class Gods + @@rule = "Uranus" + def ruler0 + @@rule + end + + def self.ruler1 # <= per method definition style + @@rule + end + class << self # <= multiple method definition style + def ruler2 + @@rule + end + end +end + +module Olympians + @@rule ="Zeus" + def ruler3 + @@rule + end +end + +class Titans < Gods + @@rule = "Cronus" + include Olympians # OK to cause warning (intentional) +end + +test_ok(Gods.new.ruler0 == "Cronus") +test_ok(Gods.ruler1 == "Cronus") +test_ok(Gods.ruler2 == "Cronus") +test_ok(Titans.ruler1 == "Cronus") +test_ok(Titans.ruler2 == "Cronus") +atlas = Titans.new +test_ok(atlas.ruler0 == "Cronus") +test_ok(atlas.ruler3 == "Zeus") + test_check "trace" $x = 1234 $y = 0 |
