Add native types under capnp.types for use with ListSchema
This commit is contained in:
@@ -7,9 +7,11 @@ struct AnnotationStruct {
|
||||
annotation test1(*): Text;
|
||||
annotation test2(*): AnnotationStruct;
|
||||
annotation test3(*): List(AnnotationStruct);
|
||||
annotation test4(*): List(UInt16);
|
||||
|
||||
$test1("TestFile");
|
||||
|
||||
struct TestAnnotationOne $test1("Test") { }
|
||||
struct TestAnnotationTwo $test2(test = 100) { }
|
||||
struct TestAnnotationThree $test3([(test=100), (test=101)]) { }
|
||||
struct TestAnnotationFour $test4([200, 201]) { }
|
||||
|
||||
@@ -44,3 +44,7 @@ def test_annotations(annotations):
|
||||
assert annotation_list[0].test == 100
|
||||
assert annotation_list[1].test == 101
|
||||
|
||||
annotation = annotations.TestAnnotationFour.schema.node.annotations[0]
|
||||
annotation_list = annotation.value.list.as_list(capnp.ListSchema(capnp.types.UInt16))
|
||||
assert annotation_list[0] == 200
|
||||
assert annotation_list[1] == 201
|
||||
|
||||
Reference in New Issue
Block a user