Reimplement indexed-for templates
Reformat tests