mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
add functions/vendor files
This commit is contained in:
30
vendor/github.com/cactus/go-statsd-client/statsd/validator_test.go
generated
vendored
Normal file
30
vendor/github.com/cactus/go-statsd-client/statsd/validator_test.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2012-2016 Eli Janssen
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package statsd
|
||||
|
||||
import "testing"
|
||||
|
||||
var validatorTests = []struct {
|
||||
Stat string
|
||||
Valid bool
|
||||
}{
|
||||
{"test.one", true},
|
||||
{"test#two", false},
|
||||
{"test|three", false},
|
||||
{"test@four", false},
|
||||
}
|
||||
|
||||
func TestValidator(t *testing.T) {
|
||||
var err error
|
||||
for _, tt := range validatorTests {
|
||||
err = CheckName(tt.Stat)
|
||||
switch {
|
||||
case err != nil && tt.Valid:
|
||||
t.Fatal(err)
|
||||
case err == nil && !tt.Valid:
|
||||
t.Fatalf("validation should have failed for %s", tt.Stat)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user