Mercurial > pymonkey
comparison tests/test_pymonkey.py @ 142:a2c1db5ece2b
Added a 'filename' member to script objects.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Mon, 24 Aug 2009 22:32:43 -0700 |
parents | ce8099238c01 |
children | df97699fc104 |
comparison
equal
deleted
inserted
replaced
141:96dc1beefc00 | 142:a2c1db5ece2b |
---|---|
46 self.assertEqual( | 46 self.assertEqual( |
47 self.last_exception.args[1], | 47 self.last_exception.args[1], |
48 u'SyntaxError: missing ; before statement' | 48 u'SyntaxError: missing ; before statement' |
49 ) | 49 ) |
50 | 50 |
51 def testScriptHasFilenameMember(self): | |
52 cx = pymonkey.Runtime().new_context() | |
53 script = cx.compile_script('foo', '<string>', 1) | |
54 self.assertEqual(script.filename, '<string>') | |
55 | |
51 def testScriptIsExposedAsBuffer(self): | 56 def testScriptIsExposedAsBuffer(self): |
52 rt = pymonkey.Runtime() | 57 rt = pymonkey.Runtime() |
53 cx = rt.new_context() | 58 cx = rt.new_context() |
54 obj = cx.new_object() | |
55 script = cx.compile_script('foo', '<string>', 1) | 59 script = cx.compile_script('foo', '<string>', 1) |
56 self.assertTrue(len(buffer(script)) > 0) | 60 self.assertTrue(len(buffer(script)) > 0) |
57 | 61 |
58 def testCompileScriptWorks(self): | 62 def testCompileScriptWorks(self): |
59 self.assertEqual(self._execjs('5 + 1'), 6) | 63 self.assertEqual(self._execjs('5 + 1'), 6) |