Skip to content

Commit

Permalink
Merge pull request #93 from openconfig/add-documentation-to-complianc…
Browse files Browse the repository at this point in the history
…eerr

Add reference for ComplianceError in String() message.
  • Loading branch information
wenovus authored Jun 6, 2023
2 parents eee44f8 + 4bd0584 commit 6131863
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ygnmi/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (c *ComplianceErrors) String() string {
return ""
}
var b strings.Builder
b.WriteString("Noncompliance Errors by category:")
b.WriteString("Noncompliance Errors by category (see https://github.com/openconfig/ygnmi#noncompliance-errors):")
b.WriteString("\nPath Noncompliance Errors:")
if len(c.PathErrors) != 0 {
for _, e := range c.PathErrors {
Expand Down
5 changes: 5 additions & 0 deletions ygnmi/unmarshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package ygnmi

import (
"strings"
"testing"
"time"

Expand Down Expand Up @@ -952,6 +953,10 @@ func TestUnmarshal(t *testing.T) {
pathErrs = complianceErrs.PathErrors
typeErrs = complianceErrs.TypeErrors
validateErrs = complianceErrs.ValidateErrors
// Validate documentation on error
if !strings.Contains(complianceErrs.String(), "https://github.com/openconfig/ygnmi#noncompliance-errors") {
t.Errorf("ComplianceError String() didn't contain expected reference to documentation.")
}
}
if len(pathErrs) > 1 {
t.Fatalf("unmarshal: got more than one path unmarshal error: %v", pathErrs)
Expand Down

0 comments on commit 6131863

Please sign in to comment.