# HG changeset patch # User Atul Varma # Date 1251654896 25200 # Node ID 9ea6a9a566e2a311528ec94a0bf85b7eb329dadd # Parent 80463c8c7930b48d772260236f3538b1c994908d Added a test. diff -r 80463c8c7930 -r 9ea6a9a566e2 tests/test_pymonkey.py --- 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; } }", + "", 1 + ) + func1 = cx.evaluate_script(obj, "build(1)", "", 1) + func2 = cx.evaluate_script(obj, "build(2)", "", 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()