-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd5e350
commit de4a57d
Showing
4 changed files
with
116 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/splitio/go-split-commons/v5/flagsets" | ||
"golang.org/x/exp/slices" | ||
"strings" | ||
"testing" | ||
) | ||
|
||
func TestFlagSetValidationError(t *testing.T) { | ||
flagSets, err := flagsets.SanitizeMany([]string{"Flagset1", " flagset2 ", "123#@flagset"}) | ||
if err == nil { | ||
t.Error("errors should not be nil") | ||
} | ||
if len(err) != 3 { | ||
t.Error("Unexpected Amount of errors. Should be 3. Was", len(err)) | ||
} | ||
if len(flagSets) != 2 { | ||
t.Error("Unexpected amount of flagsets. Should be 2. Was", len(flagSets)) | ||
} | ||
if !slices.Contains(flagSets, "flagset1") || !slices.Contains(flagSets, "flagset2") { | ||
t.Error("Missing flagsets.") | ||
} | ||
fsvError := flagSetValidationError{wrapped: err}.Error() | ||
if !strings.Contains(fsvError, "Flagset1") || !strings.Contains(fsvError, "flagset2") || !strings.Contains(fsvError, "123#@flagset") { | ||
t.Error("Missing errors on flagSetValidation.") | ||
} | ||
fmt.Printf("Flagsets: %#v", flagSets) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters