def test_make_node_fail(self): gl.SYMBOL_TABLE.declare_array('test', 1, symbols.TYPEREF(self.arr.type_, 1), bounds=self.bounds) self.arg = symbols.ARGLIST(symbols.ARGUMENT(symbols.NUMBER(2, 1), 1)) aa = symbols.ARRAYACCESS.make_node('test', self.arg, lineno=2) self.assertIsNone(aa) self.assertEqual(self.OUTPUT, "(stdin):2: Array 'test' has 2 dimensions, not 1\n")
def setUp(self): zxbpp.init() l1 = 1 l2 = 2 l3 = 3 l4 = 4 b = symbols.BOUND(l1, l2) c = symbols.BOUND(l3, l4) self.bounds = symbols.BOUNDLIST.make_node(None, b, c) self.arr = symbols.VARARRAY('test', self.bounds, 1, type_=Type.ubyte) self.arg = symbols.ARGLIST(symbols.ARGUMENT(symbols.NUMBER(2, 1, type_=Type.uinteger), 1), symbols.ARGUMENT(symbols.NUMBER(3, 1, type_=Type.uinteger), 1)) gl.SYMBOL_TABLE = SymbolTable() # Clears stderr and prepares for capturing it config.OPTIONS.remove_option('stderr') config.OPTIONS.add_option('stderr', None, StringIO()) config.OPTIONS.add_option_if_not_defined('explicit', None, False)
def setUp(self): self.VALUE = 5 self.value = symbols.NUMBER(self.VALUE, 1) self.a = symbols.ARGLIST( symbols.ARGUMENT(symbols.NUMBER(self.VALUE, 1), 1))
def test__len__(self): self.assertEqual(len(self.a), 1) b = symbols.ARGLIST() self.assertEqual(len(b), 0)