Mercurial > pymonkey
changeset 153:9ea6a9a566e2
Added a test.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 30 Aug 2009 10:54:56 -0700 |
parents | 80463c8c7930 |
children | 5ec81091cb89 |
files | tests/test_pymonkey.py |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test_pymonkey.py Sat Aug 29 22:46:48 2009 -0700 +++ b/tests/test_pymonkey.py Sun Aug 30 10:54:56 2009 -0700 @@ -252,6 +252,20 @@ del obj self.assertEqual(ref(), None) + def testFunctionsWithClosuresAreNotIdentical(self): + cx = pymonkey.Runtime().new_context() + obj = cx.new_object() + cx.init_standard_classes(obj) + cx.evaluate_script( + obj, "function build(x) { return function foo() { return x; } }", + "<string>", 1 + ) + func1 = cx.evaluate_script(obj, "build(1)", "<string>", 1) + func2 = cx.evaluate_script(obj, "build(2)", "<string>", 1) + self.assertNotEqual(func1, func2) + self.assertEqual(func1.name, 'foo') + self.assertEqual(func1.name, func2.name) + def testAnonymousJsFunctionHasNullNameAttribute(self): cx = pymonkey.Runtime().new_context() obj = cx.new_object()