diff --git a/cfca/pkcs10_test.go b/cfca/pkcs10_test.go index f363ea4..8bb833e 100644 --- a/cfca/pkcs10_test.go +++ b/cfca/pkcs10_test.go @@ -39,19 +39,19 @@ func TestCreateCertificateRequest(t *testing.T) { } _, err = CreateCertificateRequest(random, template, "", "", "") if err == nil || err.Error() != "x509: certificate private key does not implement crypto.Signer" { - t.Fatal("certificate private key does not implement crypto.Signer") + t.Fatalf("expect certificate private key does not implement crypto.Signer, got %v", err) } _, err = CreateCertificateRequest(random, template, certKey, "", "") if err == nil || err.Error() != "x509: only SM2 public key is supported" { - t.Fatal("only SM2 public key is supported") + t.Fatalf("expect only SM2 public key is supported, got %v", err) } _, err = CreateCertificateRequest(random, template, certKey, invalidTmpKey.Public(), "") if err == nil || err.Error() != "x509: only SM2 public key is supported" { - t.Fatal("only SM2 public key is supported") + t.Fatalf("expect only SM2 public key is supported, got %v", err) } _, err = CreateCertificateRequest(random, template, certKey, tmpKey.Public(), "") if err == nil || err.Error() != "x509: challenge password is required" { - t.Fatal("challenge password is required") + t.Fatalf("expect challenge password is required, got %v", err) } csrDer, err := CreateCertificateRequest(random, template, certKey, tmpKey.Public(), "111111") if err != nil { diff --git a/smx509/cfca_csr_test.go b/smx509/cfca_csr_test.go index 3baa3d3..b6151be 100644 --- a/smx509/cfca_csr_test.go +++ b/smx509/cfca_csr_test.go @@ -39,19 +39,19 @@ func TestCreateCFCACertificateRequest(t *testing.T) { } _, err = CreateCFCACertificateRequest(random, template, "", "", "") if err == nil || err.Error() != "x509: certificate private key does not implement crypto.Signer" { - t.Fatal("certificate private key does not implement crypto.Signer") + t.Fatalf("expect certificate private key does not implement crypto.Signer, got %v", err) } _, err = CreateCFCACertificateRequest(random, template, certKey, "", "") if err == nil || err.Error() != "x509: only SM2 public key is supported" { - t.Fatal("only SM2 public key is supported") + t.Fatalf("expected only SM2 public key is supported, got %v", err) } _, err = CreateCFCACertificateRequest(random, template, certKey, invalidTmpKey.Public(), "") if err == nil || err.Error() != "x509: only SM2 public key is supported" { - t.Fatal("only SM2 public key is supported") + t.Fatalf("expect only SM2 public key is supported, got %v", err) } _, err = CreateCFCACertificateRequest(random, template, certKey, tmpKey.Public(), "") if err == nil || err.Error() != "x509: challenge password is required" { - t.Fatal("challenge password is required") + t.Fatalf("expect challenge password is required, got %v", err) } csrDer, err := CreateCFCACertificateRequest(random, template, certKey, tmpKey.Public(), "111111") if err != nil {