]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: check that Version does not contain \r \n
authorRuss Cox <rsc@golang.org>
Mon, 5 Dec 2016 16:11:47 +0000 (11:11 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 5 Dec 2016 16:49:53 +0000 (16:49 +0000)
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>
src/runtime/runtime_test.go

index cd078c7eac25583618da2cdf35f53397c6bc6a11..9febbe621df4bed5835f6ef0c91ba4a8b329d078 100644 (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)
+       }
+}