diff options
| author | Ian Lance Taylor <iant@golang.org> | 2021-10-05 11:41:40 -0700 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2021-10-05 21:22:16 +0000 |
| commit | 8444a545e3d38c2e470df5035ef4b5a9365aaefc (patch) | |
| tree | c2bc6a8dbca193af6b2327829116da9a963f426c /src/text/template/exec_test.go | |
| parent | 55e7f7e12d46292e130a3b48c86bac2a6e5a1739 (diff) | |
| download | go-8444a545e3d38c2e470df5035ef4b5a9365aaefc.tar.xz | |
text/template: only unwrap final and/or value
In the last CL I missed the fact that except for the final value the
code already unwraps the argument.
For #31103
Change-Id: Ic9099aeb50c6b3322fc14a90ac8026c1d8cb1698
Reviewed-on: https://go-review.googlesource.com/c/go/+/354091
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/text/template/exec_test.go')
| -rw-r--r-- | src/text/template/exec_test.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/text/template/exec_test.go b/src/text/template/exec_test.go index 1a839a641b..9c0772945e 100644 --- a/src/text/template/exec_test.go +++ b/src/text/template/exec_test.go @@ -489,6 +489,8 @@ var execTests = []execTest{ {"and pipe-false", "{{0 | and 1}}", "0", nil, true}, {"or pipe-true", "{{1 | or 0}}", "1", nil, true}, {"or pipe-false", "{{0 | or 0}}", "0", nil, true}, + {"and undef", "{{and 1 .Unknown}}", "<no value>", nil, true}, + {"or undef", "{{or 0 .Unknown}}", "<no value>", nil, true}, {"boolean if", "{{if and true 1 `hi`}}TRUE{{else}}FALSE{{end}}", "TRUE", tVal, true}, {"boolean if not", "{{if and true 1 `hi` | not}}TRUE{{else}}FALSE{{end}}", "FALSE", nil, true}, {"boolean if pipe", "{{if true | not | and 1}}TRUE{{else}}FALSE{{end}}", "FALSE", nil, true}, |
