15 lines
332 B
Go
15 lines
332 B
Go
package cli
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func replaceRequiredOnce(t *testing.T, input, old, replacement string) string {
|
|
t.Helper()
|
|
if count := strings.Count(input, old); count != 1 {
|
|
t.Fatalf("replacement marker %q occurs %d times, want exactly once", old, count)
|
|
}
|
|
return strings.Replace(input, old, replacement, 1)
|
|
}
|