build.plat: TemplatedPlatform.iter_extra_files→Platform.iter_files.

This function was added in commit 20553b14 in the wrong place, with
the wrong name, and without tests. Fix all that.
This commit is contained in:
whitequark 2020-11-10 05:30:21 +00:00
parent ea94c9cc45
commit d6da4c257b
10 changed files with 37 additions and 24 deletions

View file

@ -51,3 +51,14 @@ class PlatformTestCase(FHDLTestCase):
with self.assertRaisesRegex(ValueError,
r"^File 'foo' already exists$"):
self.platform.add_file("foo", "bar")
def test_iter_files(self):
self.platform.add_file("foo.v", "")
self.platform.add_file("bar.v", "")
self.platform.add_file("baz.vhd", "")
self.assertEqual(list(self.platform.iter_files(".v")),
["foo.v", "bar.v"])
self.assertEqual(list(self.platform.iter_files(".vhd")),
["baz.vhd"])
self.assertEqual(list(self.platform.iter_files(".v", ".vhd")),
["foo.v", "bar.v", "baz.vhd"])