Amaury Forgeot d'Arc avatar 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!

Comments (0)

Files changed (1)

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"
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.