]> Cypherpunks repositories - gostls13.git/commit
cmd/gc: test temp string comparison with all ops
authorOleg Zaytsev <mail@olegzaytsev.com>
Fri, 9 Dec 2022 12:05:34 +0000 (13:05 +0100)
committerGopher Robot <gobot@golang.org>
Tue, 13 Dec 2022 14:05:23 +0000 (14:05 +0000)
commit61e2b8ec598e33b0d55a0652f86eeb075de3dc9d
tree7371857254e9df4927c4d1101138f3f60a2319d4
parentb16e94d13d0f9b84ed92563a12984190f91ead66
cmd/gc: test temp string comparison with all ops

The comment on `slicebytetostringtmp` mention that `==` operator does
not allocate []byte to string conversion, but the test was testing only
`==` and `!=` and the compiler actually optimizes all comparison
operators.

Also added a test for concatenation comparison, which also should not
allocate.

Change-Id: I6f4c5c4f238808138fa901732e1fd5b6ab25f725
Reviewed-on: https://go-review.googlesource.com/c/go/+/456415
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/string_test.go