Commit 149d9de4 authored by Robert Griesemer's avatar Robert Griesemer

cmd/gofmt: test that Go 2 number literals can be formatted

R=Go1.13

Updates #12711.
Updates #19308.
Updates #28493.
Updates #29008.

Change-Id: Icd25aa7f6e18ed671ea6cf2b1b292899daf4b1a5
Reviewed-on: https://go-review.googlesource.com/c/160018Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 42e0cc60
package p
const (
_ = 0
_ = 0123
_ = 0123456
_ = 0_123
_ = 0123_456
// decimals
_ = 1
_ = 1234
_ = 1234567
_ = 1_234
_ = 1_234_567
// hexadecimals
_ = 0x0
_ = 0x1234
_ = 0xcafef00d
_ = 0X0
_ = 0X1234
_ = 0XCAFEf00d
_ = 0X_0
_ = 0X_1234
_ = 0X_CAFE_f00d
// octals
_ = 0o0
_ = 0o1234
_ = 0o01234567
_ = 0O0
_ = 0O1234
_ = 0O01234567
_ = 0o_0
_ = 0o_1234
_ = 0o0123_4567
_ = 0O_0
_ = 0O_1234
_ = 0O0123_4567
// binaries
_ = 0b0
_ = 0b1011
_ = 0b00101101
_ = 0B0
_ = 0B1011
_ = 0B00101101
_ = 0b_0
_ = 0b10_11
_ = 0b_0010_1101
// decimal floats
_ = 0.
_ = 123.
_ = 0123.
_ = .0
_ = .123
_ = .0123
_ = 0e0
_ = 123e+0
_ = 0123E-1
_ = 0e-0
_ = 123E+0
_ = 0123E123
_ = 0.e+1
_ = 123.E-10
_ = 0123.e123
_ = .0e-1
_ = .123E+10
_ = .0123E123
_ = 0.0
_ = 123.123
_ = 0123.0123
_ = 0.0e1
_ = 123.123E-10
_ = 0123.0123e+456
_ = 1_2_3.
_ = 0_123.
_ = 0_0e0
_ = 1_2_3e0
_ = 0_123e0
_ = 0e-0_0
_ = 1_2_3E+0
_ = 0123E1_2_3
_ = 0.e+1
_ = 123.E-1_0
_ = 01_23.e123
_ = .0e-1
_ = .123E+10
_ = .0123E123
_ = 1_2_3.123
_ = 0123.01_23
// hexadecimal floats
_ = 0x0.p+0
_ = 0Xdeadcafe.p-10
_ = 0x1234.P123
_ = 0x.1p-0
_ = 0X.deadcafep2
_ = 0x.1234P+10
_ = 0x0p0
_ = 0Xdeadcafep+1
_ = 0x1234P-10
_ = 0x0.0p0
_ = 0Xdead.cafep+1
_ = 0x12.34P-10
_ = 0Xdead_cafep+1
_ = 0x_1234P-10
_ = 0X_dead_cafe.p-10
_ = 0x12_34.P1_2_3
// imaginaries
_ = 0i
_ = 00i
_ = 1234i
_ = 1234567i
_ = 1_234i
_ = 1_234_567i
_ = 0.i
_ = 123.i
_ = 0123.i
_ = 0.e+1i
_ = 123.E-1_0i
_ = 01_23.e123i
)
package p
const (
_ = 0
_ = 0123
_ = 0123456
_ = 0_123
_ = 0123_456
// decimals
_ = 1
_ = 1234
_ = 1234567
_ = 1_234
_ = 1_234_567
// hexadecimals
_ = 0x0
_ = 0x1234
_ = 0xcafef00d
_ = 0X0
_ = 0X1234
_ = 0XCAFEf00d
_ = 0X_0
_ = 0X_1234
_ = 0X_CAFE_f00d
// octals
_ = 0o0
_ = 0o1234
_ = 0o01234567
_ = 0O0
_ = 0O1234
_ = 0O01234567
_ = 0o_0
_ = 0o_1234
_ = 0o0123_4567
_ = 0O_0
_ = 0O_1234
_ = 0O0123_4567
// binaries
_ = 0b0
_ = 0b1011
_ = 0b00101101
_ = 0B0
_ = 0B1011
_ = 0B00101101
_ = 0b_0
_ = 0b10_11
_ = 0b_0010_1101
// decimal floats
_ = 0.
_ = 123.
_ = 0123.
_ = .0
_ = .123
_ = .0123
_ = 0e0
_ = 123e+0
_ = 0123E-1
_ = 0e-0
_ = 123E+0
_ = 0123E123
_ = 0.e+1
_ = 123.E-10
_ = 0123.e123
_ = .0e-1
_ = .123E+10
_ = .0123E123
_ = 0.0
_ = 123.123
_ = 0123.0123
_ = 0.0e1
_ = 123.123E-10
_ = 0123.0123e+456
_ = 1_2_3.
_ = 0_123.
_ = 0_0e0
_ = 1_2_3e0
_ = 0_123e0
_ = 0e-0_0
_ = 1_2_3E+0
_ = 0123E1_2_3
_ = 0.e+1
_ = 123.E-1_0
_ = 01_23.e123
_ = .0e-1
_ = .123E+10
_ = .0123E123
_ = 1_2_3.123
_ = 0123.01_23
// hexadecimal floats
_ = 0x0.p+0
_ = 0Xdeadcafe.p-10
_ = 0x1234.P123
_ = 0x.1p-0
_ = 0X.deadcafep2
_ = 0x.1234P+10
_ = 0x0p0
_ = 0Xdeadcafep+1
_ = 0x1234P-10
_ = 0x0.0p0
_ = 0Xdead.cafep+1
_ = 0x12.34P-10
_ = 0Xdead_cafep+1
_ = 0x_1234P-10
_ = 0X_dead_cafe.p-10
_ = 0x12_34.P1_2_3
// imaginaries
_ = 0i
_ = 00i
_ = 1234i
_ = 1234567i
_ = 1_234i
_ = 1_234_567i
_ = 0.i
_ = 123.i
_ = 0123.i
_ = 0.e+1i
_ = 123.E-1_0i
_ = 01_23.e123i
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment