Add null capability test

This commit is contained in:
Jason Paryani
2015-06-03 14:35:39 -07:00
parent 58667c17c3
commit 8f78a7c80b
2 changed files with 20 additions and 1 deletions

View File

@@ -77,3 +77,7 @@ interface TestTailCallee {
interface TestTailCaller {
foo @0 (i :Int32, callee :TestTailCallee) -> TestTailCallee.TailResult;
}
interface TestPassedCap {
foo @0 (cap :TestInterface) -> (x: Text);
}

View File

@@ -343,3 +343,18 @@ def test_inheritance():
response = remote.wait()
assert response.x == '26'
class TestPassedCap(capability.TestPassedCap.Server):
def foo(self, cap, _context, **kwargs):
def set_result(res):
_context.results.x = res.x
return cap.foo(5).then(set_result)
def test_null_cap():
client = capability.TestPassedCap._new_client(TestPassedCap())
assert client.foo(Server()).wait().x == '26'
with pytest.raises(capnp.KjException):
client.foo().wait()