Ejemplo n.º 1
0
def test_abstract_requires_3(snippetcompiler):
    snippetcompiler.setup_for_snippet("""
host = std::Host(name="host", os=std::unix)

entity A:
    string name
end

implementation a for A:
    one = std::ConfigFile(path="{{self.name}}1", host=host, content="")
    two = std::ConfigFile(path="{{self.name}}2", host=host, content="")
    two.requires = one
    one.requires = self.requires
    two.provides = self.provides
end

implement A using a

pre = std::ConfigFile(path="pre", host=host, content="")
post = std::ConfigFile(path="post", host=host, content="")

inter = A(name = "inter")
inter.requires = pre
post.requires = inter
""")

    v, resources = snippetcompiler.do_export()
    assert_graph(
        resources,
        """post: inter2
                                  inter2: inter1
                                  inter1: pre""",
    )
Ejemplo n.º 2
0
    def test_abstract_requires(self):
        self.setup_for_snippet("""
host = std::Host(name="host", os=std::unix)

entity A:
    string name
end

implementation a for A:
    one = std::ConfigFile(path="{{self.name}}1", host=host, content="")
    two = std::ConfigFile(path="{{self.name}}2", host=host, content="")
    two.requires = one
end

implement A using a

pre = std::ConfigFile(path="host0", host=host, content="")
post = std::ConfigFile(path="hosts4", host=host, content="")

inter = A(name = "inter")
""")

        v, resources = self.do_export()
        assert_graph(resources, """inter2: inter1""")