vault/sdk/helper/password/password_test.go
Brian Kassouf a24653cc5c
Run a more strict formatter over the code (#11312)
* Update tooling

* Run gofumpt

* go mod vendor
2021-04-08 09:43:39 -07:00

28 lines
765 B
Go

package password
import "testing"
type testCase struct {
name string
input string
expected string
}
func TestRemoveiTermDelete(t *testing.T) {
tests := []testCase{
{"NoDelete", "TestingStuff", "TestingStuff"},
{"SingleDelete", "Testing\x7fStuff", "Testing\x7fStuff"},
{"DeleteFirst", "\x7fTestingStuff", "\x7fTestingStuff"},
{"DoubleDelete", "\x7f\x7fTestingStuff", "\x7f\x7fTestingStuff"},
{"SpaceFirst", "\x20TestingStuff", "\x20TestingStuff"},
{"iTermDelete", "\x20\x7fTestingStuff", "TestingStuff"},
}
for _, test := range tests {
result := removeiTermDelete(test.input)
if result != test.expected {
t.Errorf("Test %s failed, input: '%s', expected: '%s', output: '%s'", test.name, test.input, test.expected, result)
}
}
}