Skip to content

Commit

Permalink
More tests for indexing by symbol.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewd committed Sep 27, 2009
1 parent 19ac787 commit cba8a9a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/johnson/spidermonkey/ruby_land_proxy_test.rb
Expand Up @@ -102,6 +102,20 @@ def test_can_be_indexed_by_string
assert_equal(42, proxy["bar"])
end

def test_can_be_indexed_by_symbol
proxy = @runtime.evaluate("x = { foo: 42 }")
assert_kind_of(Johnson::SpiderMonkey::RubyLandProxy, proxy)

assert_equal(42, proxy[:foo])

proxy[:foo] = 99
proxy[:bar] = 42

assert_js_equal(99, "x.foo")
assert_equal(99, proxy[:foo])
assert_equal(42, proxy[:bar])
end

def test_multilevel_indexing_works
proxy = @runtime.evaluate("x = { foo: { bar: 42 , baz: function() { return 42 } } }")
assert_equal(42, proxy["foo"]["bar"])
Expand Down

0 comments on commit cba8a9a

Please sign in to comment.