[pypy-svn] r27166 - pypy/dist/pypy/rpython/ootypesystem/test

antocuni at codespeak.net antocuni at codespeak.net
Sat May 13 14:30:29 CEST 2006


Author: antocuni
Date: Sat May 13 14:30:21 2006
New Revision: 27166

Modified:
   pypy/dist/pypy/rpython/ootypesystem/test/test_ooann.py
   pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py
Log:
Add some tests for String annotation and a failing test for oostring().



Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_ooann.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_ooann.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_ooann.py	Sat May 13 14:30:21 2006
@@ -196,5 +196,13 @@
     a = RPythonAnnotator()
     s = a.build_types(oof, [])
     #a.translator.view()
-    
+
     assert s == annmodel.SomeOOInstance(L)
+
+def test_string():
+    def oof():
+        return new(String)
+
+    a = RPythonAnnotator()
+    s = a.build_types(oof, [])
+    assert s == annmodel.SomeOOInstance(String)

Modified: pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/test/test_oortype.py	Sat May 13 14:30:21 2006
@@ -187,3 +187,18 @@
     INST = graph.getreturnvar().concretetype
     assert rtyper.exceptiondata.is_exception_instance(INST)
 
+def test_string_annotation():
+    def oof(lst):
+        return lst.ll_strlen()
+
+    s = new(String)
+    assert interpret(oof, [s], type_system='ootype') == 0
+    s = make_string('foo')
+    assert interpret(oof, [s], type_system='ootype') == 3
+
+def test_oostring():
+    def oof(ch):
+        return oostring(ch)
+
+    ch = 'a'
+    res = interpret(oof, [ch], type_system='ootype')



More information about the Pypy-commit mailing list