From: Russ Cox Date: Mon, 5 Dec 2016 16:11:47 +0000 (-0500) Subject: runtime: check that Version does not contain \r \n X-Git-Tag: go1.8beta2~94 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7e9fa3c3213fc1a4174fe5d6692c83f5610dff42;p=gostls13.git runtime: check that Version does not contain \r \n Change-Id: I8982cfa7337ec457b5235a207ebfda00ef6a2e5a Reviewed-on: https://go-review.googlesource.com/33917 Run-TryBot: Russ Cox TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/runtime/runtime_test.go b/src/runtime/runtime_test.go index cd078c7eac..9febbe621d 100644 --- a/src/runtime/runtime_test.go +++ b/src/runtime/runtime_test.go @@ -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) + } +}