Unit tests for nested templates (#7749)

Change-Id: I0190870de8d7d15406cbe54ae8dc0b7761a13910