func TestCloneThenParse(t *testing.T) {
	t0 := Must(New("t0").Parse(`{{define "a"}}{{template "embedded"}}{{end}}`))
	t1 := Must(t0.Clone())
	Must(t1.Parse(`{{define "embedded"}}t1{{end}}`))
	if len(t0.Templates())+1 != len(t1.Templates()) {
		t.Error("adding a template to a clone added it to the original")
	}
	err := t0.ExecuteTemplate(ioutil.Discard, "a", nil)
	if err == nil {
		t.Error("expected 'no such template' error")
	}
}
Ensure that this guarantee from the docs is upheld:
"Further calls to Parse in the copy will add templates
to the copy but not to the original."
package template
import (
	"bytes"
	"errors"
	"fmt"
	"io/ioutil"
	"strings"
	"sync"
	"testing"
)
func TestClone(t *testing.T) {
	const tmpl = `{{define "a"}}{{template "lhs"}}{{.}}{{template "rhs"}}{{end}}`
	const data = `<i>*/`
	b := new(bytes.Buffer)
	t0 := Must(New("t0").Parse(tmpl))
	t1 := Must(t0.Clone())
	Must(t1.Parse(`{{define "lhs"}} <q cite="/foo?{{end}}`))
	Must(t1.Parse(`{{define "rhs"}}"></q> {{end}}`))
	b.Reset()
	if err := t1.ExecuteTemplate(b, "a", data); err != nil {
		t.Fatal(err)
	}
	if got, want := b.String(), ` <q cite="/foo?%3ci%3e%2a%2f"></q> `; got != want {
		t.Errorf("t1: got %q want %q", got, want)
	}
	t2 := Must(t0.Clone())
	Must(t2.Parse(`{{define "lhs"}} <script>{{end}}`))
	Must(t2.Parse(`{{define "rhs"}}</script> {{end}}`))
	b.Reset()
	err := t2.ExecuteTemplate(b, "a", data)
	if err == nil {
		t.Fatalf("t2: got %q, expected error", b.String())
	}
	if got, want := err.Error(), `expected a safehtml.Script value`; !strings.Contains(got, want) {
		t.Errorf("t2: error\n\t%q\ndoes not contain\n\t%q", got, want)
	}
	t3 := Must(t0.Clone())
	Must(t3.Parse(`{{define "lhs"}} <style> {{end}}`))
	Must(t3.Parse(`{{define "rhs"}} </style> {{end}}`))
	Must(t0.Parse(`{{define "lhs"}} ( {{end}}`))
	Must(t0.Parse(`{{define "rhs"}} ) {{end}}`))
	t4 := Must(t0.Clone())
	if _, err := t4.Parse(`{{define "lhs"}} OK {{end}}`); err != nil {
		t.Errorf(`redefine "lhs": got err %v want nil`, err)
	}
	if _, err := t1.Clone(); err == nil {
		t.Error("cloning t1: got nil err want non-nil")
	}
	if _, err := t1.Parse(`{{define "lhs"}} OK {{end}}`); err == nil {
		t.Error(`redefine "lhs": got nil err want non-nil`)
	}
	b.Reset()
	if err := t0.ExecuteTemplate(b, "a", data); err != nil {
		t.Fatal(err)
	}
	if got, want := b.String(), ` ( &lt;i&gt;*/ ) `; got != want {
		t.Errorf("t0: got %q want %q", got, want)
	}
	if _, err := t0.Clone(); err == nil {
		t.Error(`t0.Clone(): got nil err want non-nil`)
	}
	if _, err := t0.Lookup("a").Clone(); err == nil {
		t.Error(`t0.Lookup("a").Clone(): got nil err want non-nil`)
	}
	if _, err := t0.Lookup("lhs").Clone(); err == nil {
		t.Error(`t0.Lookup("lhs").Clone(): got nil err want non-nil`)
	}
	b.Reset()
	err = t3.ExecuteTemplate(b, "a", data)
	if err == nil {
		t.Fatalf("t3: got %q, expected error", b.String())
	}
	if got, want := err.Error(), `expected a safehtml.StyleSheet value`; !strings.Contains(got, want) {
		t.Errorf("t3: error\n\t%q\ndoes not contain\n\t%q", got, want)
	}
}
func TestCloneCrash(t *testing.T) {
	t1 := New("all")
	Must(t1.New("t1").Parse(`{{define "foo"}}foo{{end}}`))
	t1.Clone()
}