hdl.rec: use a helpful error on unknown field reference.
This commit is contained in:
parent
d78e6c155b
commit
031a9e2616
2 changed files with 15 additions and 2 deletions
|
|
@ -78,3 +78,12 @@ class RecordTestCase(FHDLTestCase):
|
|||
|
||||
self.assertEqual(repr(r), "(rec <unnamed> stb)")
|
||||
self.assertEqual(r.stb.name, "stb")
|
||||
|
||||
def test_wrong_field(self):
|
||||
r = Record([
|
||||
("stb", 1),
|
||||
("ack", 1),
|
||||
])
|
||||
with self.assertRaises(NameError,
|
||||
msg="Record does not have a field 'en'. Did you mean one of: stb, ack?"):
|
||||
r.en
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue