• Dmitri Shuralyov's avatar
    crypto/x509: fix panic in TestEnvVars, improve style · 441fd133
    Dmitri Shuralyov authored
    This panic happens when the test fails due to the returned number of
    certificates (r.certs) being less than expected by test case (tc.cns).
    When i == len(r.certs) in the for loop, r.certs[i] will cause an index
    out of range panic.
    
    Also improve readability, consistency and style of the code. Use the
    more common "got x, want y" pattern. See https://golang.org/s/style#useful-test-failures
    for reference (and grep codebase for most common occurrences). Add a
    comment, and remove blank line separating two blocks that are both
    related to verifying that len(r.certs) == len(tc.cns). This should
    help with readability.
    
    Remove space after colon in call to t.Fatal, since it adds spaces
    between its arguments.
    
    Fixes #20801.
    
    Change-Id: I40476103f1b5a0fa74b05637c250926b571c92fd
    Reviewed-on: https://go-review.googlesource.com/46715
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    441fd133
Name
Last commit
Last update
..
pkix Loading commit data...
testdata Loading commit data...
cert_pool.go Loading commit data...
example_test.go Loading commit data...
pem_decrypt.go Loading commit data...
pem_decrypt_test.go Loading commit data...
pkcs1.go Loading commit data...
pkcs8.go Loading commit data...
pkcs8_test.go Loading commit data...
root.go Loading commit data...
root_bsd.go Loading commit data...
root_cgo_darwin.go Loading commit data...
root_darwin.go Loading commit data...
root_darwin_arm_gen.go Loading commit data...
root_darwin_armx.go Loading commit data...
root_darwin_test.go Loading commit data...
root_linux.go Loading commit data...
root_nacl.go Loading commit data...
root_nocgo_darwin.go Loading commit data...
root_plan9.go Loading commit data...
root_solaris.go Loading commit data...
root_unix.go Loading commit data...
root_unix_test.go Loading commit data...
root_windows.go Loading commit data...
sec1.go Loading commit data...
sec1_test.go Loading commit data...
sha2_windows_test.go Loading commit data...
test-file.crt Loading commit data...
verify.go Loading commit data...
verify_test.go Loading commit data...
x509.go Loading commit data...
x509_test.go Loading commit data...
x509_test_import.go Loading commit data...