Begin rewrite of template tests as individual tests.

This adds the basic infrastructure for #23768 and ports over the basic
syntax and include tests.

Other tests can be ported in separate commits for easier review.