aboutsummaryrefslogtreecommitdiff
path: root/src/html/template/testdata
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-07-06 12:27:01 -0400
committerRuss Cox <rsc@golang.org>2020-07-14 16:54:25 +0000
commitefbe47b1625422f21bb2f130f916ce040756dbe3 (patch)
tree4007ee6438314a4bb1fef4a87ec8c2cc0a791b66 /src/html/template/testdata
parente88ea87e7b886815cfdadc4cd3d70bf5ef833bd7 (diff)
downloadgo-efbe47b1625422f21bb2f130f916ce040756dbe3.tar.xz
html/template: add tests from text/template
Copy and adapt tests from text/template, to exercise more of html/template's copy. Various differences in behavior are flagged with NOTE comments or t.Skip and documented in #40075. Many of them are probably bugs. One clarifying test case added to both text/template and html/template. No changes to the package itself. Change-Id: Ifefad83d647db846040d24c2741a0244b00ade82 Reviewed-on: https://go-review.googlesource.com/c/go/+/241084 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/html/template/testdata')
-rw-r--r--src/html/template/testdata/file1.tmpl2
-rw-r--r--src/html/template/testdata/file2.tmpl2
-rw-r--r--src/html/template/testdata/tmpl1.tmpl3
-rw-r--r--src/html/template/testdata/tmpl2.tmpl3
4 files changed, 10 insertions, 0 deletions
diff --git a/src/html/template/testdata/file1.tmpl b/src/html/template/testdata/file1.tmpl
new file mode 100644
index 0000000000..febf9d9f89
--- /dev/null
+++ b/src/html/template/testdata/file1.tmpl
@@ -0,0 +1,2 @@
+{{define "x"}}TEXT{{end}}
+{{define "dotV"}}{{.V}}{{end}}
diff --git a/src/html/template/testdata/file2.tmpl b/src/html/template/testdata/file2.tmpl
new file mode 100644
index 0000000000..39bf6fb9ee
--- /dev/null
+++ b/src/html/template/testdata/file2.tmpl
@@ -0,0 +1,2 @@
+{{define "dot"}}{{.}}{{end}}
+{{define "nested"}}{{template "dot" .}}{{end}}
diff --git a/src/html/template/testdata/tmpl1.tmpl b/src/html/template/testdata/tmpl1.tmpl
new file mode 100644
index 0000000000..b72b3a340c
--- /dev/null
+++ b/src/html/template/testdata/tmpl1.tmpl
@@ -0,0 +1,3 @@
+template1
+{{define "x"}}x{{end}}
+{{template "y"}}
diff --git a/src/html/template/testdata/tmpl2.tmpl b/src/html/template/testdata/tmpl2.tmpl
new file mode 100644
index 0000000000..16beba6e7d
--- /dev/null
+++ b/src/html/template/testdata/tmpl2.tmpl
@@ -0,0 +1,3 @@
+template2
+{{define "y"}}y{{end}}
+{{template "x"}}