Beispiel #1
0
    def init(self):
        content = """
field length: unsigned long
		"""
        ctx = Context.createFromMemory(content)
        readWpp(ctx, self)
        length = self.dictionary['length']
        length.cloneScheme = 'Owner'
Beispiel #2
0
    def init(self):
        content = """
field length: unsigned long
	cloneScheme Owner
method push
	cloneScheme Owner
	param item: const ref @Item
		"""
        ctx = Context.createFromMemory(content)
        readWpp(ctx, self)
Beispiel #3
0
    def testOffsetError(self):
        lines = """
module A
		class B
		"""
        context = Context.createFromMemory(lines, 'main')
        core = Core()
        with self.assertRaises(ErrorTaxon) as cm:
            readWpp(context, core)
        self.assertEqual(cm.exception.args[0], 'Invalid offset')
Beispiel #4
0
    def init(self):
        content = """
field length: unsigned long
method push
	param item: Array.TItem
method pop: Array.TItem
		"""
        titem = self.addNamedItem(ArrayItemType(name='TItem'))
        titem.attrs.add('public')
        ctx = Context.createFromMemory(content)
        readWpp(ctx, self)
Beispiel #5
0
    def testMain(self):
        lines = """
module Left
	class A1
	class A2
module Middle
module Right
	module SubRight
		class C1
		"""
        context = Context.createFromMemory(lines, 'main')
        core = Core()
        readWpp(context, core)
        self.assertEqual(len(core.items), 3)
        left, middle, right = core.items
        self.assertEqual(left.type, 'module')
        self.assertEqual(left.name, 'Left')
        self.assertEqual(len(left.items), 2)
        self.assertEqual(left.items[0].type, 'class')
        self.assertEqual(left.items[0].name, 'A1')
        self.assertEqual(left.items[1].type, 'class')
        self.assertEqual(left.items[1].name, 'A2')

        self.assertEqual(middle.type, 'module')
        self.assertEqual(middle.name, 'Middle')
        self.assertEqual(len(middle.items), 0)

        self.assertEqual(right.type, 'module')
        self.assertEqual(right.name, 'Right')
        self.assertEqual(len(right.items), 1)
        subRight = right.items[0]
        self.assertEqual(subRight.type, 'module')
        self.assertEqual(subRight.name, 'SubRight')
        self.assertEqual(len(subRight.items), 1)
        self.assertEqual(subRight.items[0].type, 'class')
        self.assertEqual(subRight.items[0].name, 'C1')
Beispiel #6
0
	def read(self, context):
		readWpp(context, self)