summaryrefslogtreecommitdiff
path: root/tests/format/symbol.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/format/symbol.py')
-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')