diff options
author | Russ Cox <rsc@golang.org> | 2019-01-29 23:21:29 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2019-02-26 05:18:38 +0000 |
commit | 3cf56e78d812069d2ffb65b5c29a76961b0b0af8 (patch) | |
tree | 87030b7ca0a2b40a406a12db80f84d3154b9d5c4 /src/html | |
parent | f601d412ceae1338999b203c50168af34285c634 (diff) | |
download | go-3cf56e78d812069d2ffb65b5c29a76961b0b0af8.tar.gz go-3cf56e78d812069d2ffb65b5c29a76961b0b0af8.zip |
text/template: accept new number syntax
This CL updates text/template's scanner to accept the
new number syntaxes:
- Hexadecimal floating-point values.
- Digit-separating underscores.
- Leading 0b and 0o prefixes.
See golang.org/design/19308-number-literals for background.
For #12711.
For #19308.
For #28493.
For #29008.
Change-Id: I68c16ea35c3f506701063781388de72bafee6b8d
Reviewed-on: https://go-review.googlesource.com/c/160248
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/html')
-rw-r--r-- | src/html/template/template_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/html/template/template_test.go b/src/html/template/template_test.go index 90c5a73ba7..13e6ba406e 100644 --- a/src/html/template/template_test.go +++ b/src/html/template/template_test.go @@ -115,6 +115,12 @@ func TestRedefineOtherParsers(t *testing.T) { } } +func TestNumbers(t *testing.T) { + c := newTestCase(t) + c.mustParse(c.root, `{{print 1_2.3_4}} {{print 0x0_1.e_0p+02}}`) + c.mustExecute(c.root, nil, "12.34 7.5") +} + type testCase struct { t *testing.T root *Template |