diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-29 13:56:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-29 13:56:33 +0000 |
commit | 771c8ed338ac77d3f75acf44cd711f80c80cbe71 (patch) | |
tree | 3849c4cb7589d00a49ccbe4e6d36e77e3390ed26 /test | |
parent | 3dab183c8276c6d53c9ac4404967b18f4c10d166 (diff) | |
download | ruby-771c8ed338ac77d3f75acf44cd711f80c80cbe71.tar.gz |
parse.y: fix inconsistency with literals
* parse.y (rb_id_attrset): fix inconsistency with literals, allow
ID_ATTRSET and return it itself, but ID_JUNK cannot make ID_ATTRSET.
and raise a NameError instead of rb_bug() for invalid argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/-ext-/symbol/test_type.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/-ext-/symbol/test_type.rb b/test/-ext-/symbol/test_type.rb index 427888eeb9..fe79502b83 100644 --- a/test/-ext-/symbol/test_type.rb +++ b/test/-ext-/symbol/test_type.rb @@ -91,6 +91,19 @@ module Test_Symbol assert_not_symtype("@@foo", :attrset?) assert_not_symtype("$foo", :attrset?) assert_not_symtype("[foo]", :attrset?) + assert_not_symtype("[foo]=", :attrset?) + assert_equal(:"foo=", Bug::Symbol.attrset("foo")) + assert_symtype(Bug::Symbol.attrset("foo"), :attrset?) + assert_equal(:"Foo=", Bug::Symbol.attrset("Foo")) + assert_symtype(Bug::Symbol.attrset("Foo"), :attrset?) + assert_equal(:"@foo=", Bug::Symbol.attrset("@foo")) + assert_symtype(Bug::Symbol.attrset("@foo"), :attrset?) + assert_equal(:"@@foo=", Bug::Symbol.attrset("@@foo")) + assert_symtype(Bug::Symbol.attrset("@@foo"), :attrset?) + assert_equal(:"$foo=", Bug::Symbol.attrset("$foo")) + assert_symtype(Bug::Symbol.attrset("$foo"), :attrset?) + assert_raise(NameError) {Bug::Symbol.attrset("[foo]")} + assert_equal(:[]=, Bug::Symbol.attrset(:[])) end end end |