Commits

Amaury Forgeot d'Arc  committed fba9888

A test that I would like to pass:
a Controller should be able to support method calls on the Controlled object.

Help needed!

  • Participants
  • Parent commits 7bb4ab1
  • Branches separate-compilation

Comments (0)

Files changed (1)

File pypy/rpython/test/test_controllerentry.py

     def set_foo(self, obj, value):
         value.append(obj)
 
+    # XXX this is probably not the right way
+    def get_compute(self, obj):
+        def compute(obj, arg):
+            return obj + arg
+        return compute
+
     def getitem(self, obj, key):
         return obj + key
 
     assert ''.join(res.item0.chars) == "4_bar"
     assert ''.join(res.item1.chars) == "4_foo"
     assert ''.join(res.item2.chars) == "4_baz"
+
+def fun4(a):
+    c = C(a)
+    return c.compute('bar')
+
+def test_boundmethods_annotate():
+    a = RPythonAnnotator()
+    s = a.build_types(fun4, [a.bookkeeper.immutablevalue("5")])
+    assert s.const == "5_bar"
+
+def test_boundmethods_specialize():
+    res = interpret(fun4, ["5"])
+    assert ''.join(res.chars) == "5_bar"
+