[pypy-svn] r18655 - in pypy/dist/pypy/rpython: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Sat Oct 15 19:27:39 CEST 2005
Author: cfbolz
Date: Sat Oct 15 19:27:36 2005
New Revision: 18655
Modified:
pypy/dist/pypy/rpython/llinterp.py
pypy/dist/pypy/rpython/test/test_ootype_llinterp.py
Log:
(bert, cfbolz):
add ootype operation oosend to llinterp + test
Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py (original)
+++ pypy/dist/pypy/rpython/llinterp.py Sat Oct 15 19:27:36 2005
@@ -635,6 +635,11 @@
assert isinstance(inst, ootype._instance)
assert isinstance(name, str)
return getattr(inst, name)
+
+ def op_oosend(self, message, inst, *args):
+ assert isinstance(inst, ootype._instance)
+ assert isinstance(message, str)
+ return getattr(inst, message)(*args)
# by default we route all logging messages to nothingness
# e.g. tests can then switch on logging to get more help
Modified: pypy/dist/pypy/rpython/test/test_ootype_llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_ootype_llinterp.py (original)
+++ pypy/dist/pypy/rpython/test/test_ootype_llinterp.py Sat Oct 15 19:27:36 2005
@@ -11,4 +11,18 @@
result = interpret(f, [], type_system="ootype")
assert result == 5
-
+
+def test_simple_method():
+ C = Instance("test", None, {'a': (Signed, 3)})
+ M = Meth([], Signed)
+ def m_(self):
+ return self.a
+ m = meth(M, _name="m", _callable=m_)
+ addMethods(C, {"m": m})
+
+ def f():
+ c = new(C)
+ return c.m()
+
+ result = interpret(f, [], type_system="ootype")
+ assert result == 3
More information about the Pypy-commit
mailing list