Esempio n. 1
0
def _create_tree_with_explicit_reference(name):
    root = Root().insert(
        nodes.Namespace(name="ns").insert(
            nodes.Structure(name="Struct").insert(nodes.Field(name="Field")),
            Archive(name="Archive").insert(
                res.Vector(name="resource").insert(
                    refs.FieldReference(name="Struct.Field"),
                    refs.ResourceReference(name=name)),
                res.Vector(name="resource2"))))
    return SyntaxTree(root)
Esempio n. 2
0
def test_implicit_references_structure_is_resolved():
    root = Root().insert(
        nodes.Namespace("n").insert(
            Archive("A").insert(
                res.Vector("r1"), res.Vector("r2"),
                res.BoundResource("b").insert(
                    refs.ResourceReference("A.r1"),
                    refs.ResourceReference("A.r2")))))
    resolve_references(root)
    assert_equal("@@n@A@r1", root.find('.n.A.b').children[0].name)
    assert_equal("@@n@A@r2", root.find('.n.A.b').children[1].name)
Esempio n. 3
0
def _create_tree_resource_to_struct_with_extra_folding(actual, reference):
    root = Root().insert(
        nodes.Namespace(name="ns").insert(
            nodes.Namespace(name="fold").insert(nodes.Structure(name=actual)),
            Archive(name="Archive").insert(
                res.Vector(name="resource").insert(
                    refs.StructureReference(name=reference)))))
    return SyntaxTree(root)