[pypy-svn] r7308 - pypy/trunk/src/pypy/translator/test

mgedmin at codespeak.net mgedmin at codespeak.net
Wed Nov 17 10:32:06 CET 2004


Author: mgedmin
Date: Wed Nov 17 10:32:06 2004
New Revision: 7308

Modified:
   pypy/trunk/src/pypy/translator/test/snippet.py
   pypy/trunk/src/pypy/translator/test/test_annrpython.py
Log:
Added a unit test to check whether calling prebuilt constants is able to
follow the call graph.



Modified: pypy/trunk/src/pypy/translator/test/snippet.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/snippet.py	(original)
+++ pypy/trunk/src/pypy/translator/test/snippet.py	Wed Nov 17 10:32:06 2004
@@ -279,6 +279,16 @@
     else:
         return never_called()
 
+class CallablePrebuiltConstant(object):
+    def __call__(self):
+        return 42
+
+callable_prebuilt_constant = CallablePrebuiltConstant()
+
+def call_cpbc():
+    return callable_prebuilt_constant()
+
+
 # INHERITANCE / CLASS TESTS  
 class C(object): pass
 

Modified: pypy/trunk/src/pypy/translator/test/test_annrpython.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_annrpython.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_annrpython.py	Wed Nov 17 10:32:06 2004
@@ -268,6 +268,12 @@
         a.simplify()
         #a.translator.view()
 
+    def test_call_pbc(self):
+        a = RPythonAnnotator()
+        s = a.build_types(snippet.call_cpbc, [])
+        self.assertEquals(s, annmodel.immutablevalue(42))
+
+
 def g(n):
     return [0,1,2,n]
 



More information about the Pypy-commit mailing list