1
0

unittest: add an API for describing LazyModule unit tests

This commit is contained in:
Wesley W. Terpstra
2017-11-07 16:02:35 -08:00
parent cc789e9063
commit fdeed7bbb3
3 changed files with 51 additions and 1 deletions

View File

@ -36,7 +36,8 @@ abstract class LazyModule()(implicit val p: Parameters)
getClass.getMethods.filter { m =>
m.getParameterTypes.isEmpty &&
!java.lang.reflect.Modifier.isStatic(m.getModifiers) &&
m.getName != "children"
m.getName != "children" &&
m.getName != "getChildren"
}.flatMap { m =>
if (classOf[LazyModule].isAssignableFrom(m.getReturnType)) {
val obj = m.invoke(this)
@ -126,6 +127,8 @@ abstract class LazyModule()(implicit val p: Parameters)
iterfunc(this)
children.foreach( _.nodeIterator(iterfunc) )
}
def getChildren = children
}
object LazyModule