1
0
mirror of https://github.com/golang/go synced 2024-11-18 02:54:47 -07:00

runtime: check that Version does not contain \r \n

Change-Id: I8982cfa7337ec457b5235a207ebfda00ef6a2e5a
Reviewed-on: https://go-review.googlesource.com/33917
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Russ Cox 2016-12-05 11:11:47 -05:00
parent ed0b232cdc
commit 7e9fa3c321

View File

@ -8,6 +8,7 @@ import (
"io"
. "runtime"
"runtime/debug"
"strings"
"testing"
"unsafe"
)
@ -329,3 +330,11 @@ func TestGoroutineProfileTrivial(t *testing.T) {
}
}
}
func TestVersion(t *testing.T) {
// Test that version does not contain \r or \n.
vers := Version()
if strings.Contains(vers, "\r") || strings.Contains(vers, "\n") {
t.Fatalf("cr/nl in version: %q", vers)
}
}