cmd/compile: improve issue62407_test

The original issue62407_test also passes with versions prior to 1.23.
The improvement makes it fail with versions prior to 1.23.

Change-Id: I94bfb9d1ac695c8e07997d7029fc2101535e14f8
GitHub-Last-Rev: 44be2a610a
GitHub-Pull-Request: golang/go#70938
Reviewed-on: https://go-review.googlesource.com/c/go/+/638036
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
go101 2024-12-21 13:31:27 +00:00 committed by Gopher Robot
parent f27d86c631
commit 6f90ae3623
1 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import (
)
//go:noinline
func foo() string { return "foo" }
func foo() string { return "foofoofoofoofoofo" } // len == 17
//go:noinline
func empty() string { return "" }
@ -23,8 +23,8 @@ func TestConcatBytes(t *testing.T) {
want []byte
}{
"two empty elements": {got: []byte(empty + empty), want: []byte{}},
"two nonempty elements": {got: []byte(s + s), want: []byte("foofoo")},
"one empty and one nonempty element": {got: []byte(s + empty), want: []byte("foo")},
"two nonempty elements": {got: []byte(s + s), want: append([]byte(foo()), foo()...)},
"one empty and one nonempty element": {got: []byte(s + empty), want: []byte(foo())},
"multiple empty elements": {got: []byte(empty + empty + empty + empty + empty + empty), want: []byte{}},
"multiple nonempty elements": {got: []byte("1" + "2" + "3" + "4" + "5" + "6"), want: []byte("123456")},
}