summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-08-15 08:01:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-08-15 08:01:39 (GMT)
commit340cbdbc4abedd060f3eb6745cd44e33ed19b93c (patch)
tree336778491b1131a6384669d290837c2a46442b60 /tests
parent60b70b8701c822eddc65269773621690932a57bd (diff)
Introduced binary symbol subclassing from Python.
Diffstat (limited to 'tests')
-rw-r--r--tests/format/symbol.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/format/symbol.py b/tests/format/symbol.py
index 5e0ba10..6cffe57 100644
--- a/tests/format/symbol.py
+++ b/tests/format/symbol.py
@@ -84,3 +84,32 @@ class TestBinarySymbols(ChrysalideTestCase):
self.assertTrue(symbol1 < symbol2)
self.assertTrue(symbol0 == symbol2)
+
+
+ def testSymbolSubclassing(self):
+ """Verify the symbol subclassing is working."""
+
+ class MySymbol(BinSymbol):
+ def _get_label(self):
+ return 'AAA'
+
+ saddr = vmpa(0x100, vmpa.VMPA_NO_VIRTUAL)
+ srange = mrange(saddr, 0x3)
+ symbol = MySymbol(BinSymbol.SymbolType.ENTRY_POINT, srange)
+
+ self.assertEqual(symbol.label, 'AAA')
+
+ symbol.label = 'BBB'
+
+ self.assertEqual(symbol.label, 'BBB')
+
+ class MyOtherSymbol(BinSymbol):
+ pass
+
+ other = MyOtherSymbol(BinSymbol.SymbolType.ENTRY_POINT, srange)
+
+ self.assertEqual(other.label, None)
+
+ other.label = 'CCC'
+
+ self.assertEqual(other.label, 'CCC')