Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for AddParseTree (0.69 sec)

  1. src/html/template/escape_test.go

    		data     = `<baz>`
    		want     = `&lt;baz&gt;`
    	)
    	// Templates "foo" and "bar" both alias the same underlying parse tree.
    	tpl := Must(New("foo").Parse(tmplText))
    	if _, err := tpl.AddParseTree("bar", tpl.Tree); err != nil {
    		t.Fatalf("AddParseTree error: %v", err)
    	}
    	var b1, b2 strings.Builder
    	if err := tpl.ExecuteTemplate(&b1, "foo", data); err != nil {
    		t.Fatalf(`ExecuteTemplate failed for "foo": %v`, err)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 16 03:29:27 UTC 2023
    - 56.2K bytes
    - Viewed (0)
  2. src/text/template/exec_test.go

    	}
    	// Add a non-empty template to check that the error is helpful.
    	tests, err := New("").Parse(testTemplates)
    	if err != nil {
    		t.Fatal(err)
    	}
    	tmpl.AddParseTree("secondary", tests.Tree)
    	err = tmpl.Execute(&b, 0)
    	if err == nil {
    		t.Fatal("expected second error")
    	}
    	got = err.Error()
    	want = `template: empty: "empty" is an incomplete or empty template`
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 24 22:23:55 UTC 2024
    - 60.1K bytes
    - Viewed (0)
  3. src/html/template/exec_test.go

    	}
    
    	// Add a non-empty template to check that the error is helpful.
    	tmpl = New("empty")
    	tests, err := New("").Parse(testTemplates)
    	if err != nil {
    		t.Fatal(err)
    	}
    	tmpl.AddParseTree("secondary", tests.Tree)
    	err = tmpl.Execute(&b, 0)
    	if err == nil {
    		t.Fatal("expected second error")
    	}
    	got = err.Error()
    	if got != want {
    		t.Errorf("expected error %s got %s", want, got)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 24 21:59:12 UTC 2024
    - 57.6K bytes
    - Viewed (0)
Back to top