Ejemplo n.º 1
0
    def test_namespaces(self):
        """A Package should return a NamespaceNode for each namespace defined within it."""

        node = PackageNode.with_name(self.repos, 'TestPackage1', '1.0')
        self.assertTrue(
            (NamespaceNode, '/TestPackage1/StracTest') in
            ((x.__class__, x.path) for x in node.get_entries()))
Ejemplo n.º 2
0
    def test_class_overrides(self):
        """A Package should return a ClassExtensionNode for each class override it contains."""

        node = PackageNode.with_name(self.repos, 'TestPackage1', '1.0')
        children = [x for x in node.get_entries()]
        self.assertTrue(
            (ClassExtensionNode, '/TestPackage1/Core.Object') in
            ((x.__class__, x.path) for x in children))
Ejemplo n.º 3
0
    def test_shared_variable(self):
        """ClassNodes should know about shared variables they contain."""

        package = PackageNode.with_name(self.repos, 'TestPackage2', '1.0')
        node = package.subnode_named('StracTest.StracClass21')
        self.assertEquals(
            ['VarName'],
            [sv.name for sv in node.get_shared_variables()])
        sv = node.get_shared_variables()[0]
        expected = """StracTest.StracClass21 defineSharedVariable: #VarName
\tprivate: false
\tconstant: false
\tcategory: 'testing'
\tinitializer: 'Array new: 5'"""
        actual = sv.definition
        self.assertEquals(expected, actual)
Ejemplo n.º 4
0
    def test_shared_variable(self):
        """
        Class extensions should know about shared variables they contain, even if
        the shared variable is the only thing in that extension.
        """
        
        package = PackageNode.with_name(self.repos, 'TestPackage1', '1.0')
        node = package.subnode_named('Core.Point')
        self.assertEquals(
            ['ExtraVar'],
            [sv.name for sv in node.get_shared_variables()])
        sv = node.get_shared_variables()[0]
        self.assertEquals(
"""Core.Point defineSharedVariable: #ExtraVar
\tprivate: false
\tconstant: false
\tcategory: 'extended'
\tinitializer: 'Array new: 5'""", sv.definition)
Ejemplo n.º 5
0
 def setUp(self):
     StoreTestCase.setUp(self)
     self.pkg_node = PackageNode.with_name(self.repos, 'TestPackage1', '1.0')
     self.node = self.pkg_node.subnode_named('StracTest.StracClass11')
Ejemplo n.º 6
0
 def setUp(self):
     StoreTestCase.setUp(self)
     self.package = PackageNode.with_name(self.repos, 'TestPackage1')
     self.node = self.package.subnode_named('StracTest')
Ejemplo n.º 7
0
 def setUp(self):
     StoreTestCase.setUp(self)
     self.node = PackageNode.with_name(self.repos, 'TestPackage2', '1.0')
Ejemplo n.º 8
0
 def setUp(self):
     StoreTestCase.setUp(self)
     self.pkg_node = PackageNode.with_name(self.repos, 'TestPackage1', '1.0')
     self.node = self.pkg_node.subnode_named('Core.Object')