diff --git a/cty/function/stdlib/string_replace.go b/cty/function/stdlib/string_replace.go index b40e5d6f..f777ce5c 100644 --- a/cty/function/stdlib/string_replace.go +++ b/cty/function/stdlib/string_replace.go @@ -36,10 +36,10 @@ var ReplaceFunc = function.New(&function.Spec{ }, }) -// RegexpReplaceFunc is a function that searches a given string for another +// RegexReplaceFunc is a function that searches a given string for another // given substring, and replaces each occurence with a given replacement // string. The substr argument must be a valid regular expression. -var RegexpReplaceFunc = function.New(&function.Spec{ +var RegexReplaceFunc = function.New(&function.Spec{ Params: []function.Parameter{ { Name: "str", @@ -75,6 +75,6 @@ func Replace(str, substr, replace cty.Value) (cty.Value, error) { return ReplaceFunc.Call([]cty.Value{str, substr, replace}) } -func RegexpReplace(str, substr, replace cty.Value) (cty.Value, error) { - return RegexpReplaceFunc.Call([]cty.Value{str, substr, replace}) +func RegexReplace(str, substr, replace cty.Value) (cty.Value, error) { + return RegexReplaceFunc.Call([]cty.Value{str, substr, replace}) } diff --git a/cty/function/stdlib/string_replace_test.go b/cty/function/stdlib/string_replace_test.go index 0e2664ec..052e2cca 100644 --- a/cty/function/stdlib/string_replace_test.go +++ b/cty/function/stdlib/string_replace_test.go @@ -80,7 +80,7 @@ func TestRegexReplace(t *testing.T) { for _, test := range tests { t.Run(test.Input.GoString(), func(t *testing.T) { - got, err := RegexpReplace(test.Input, test.Substr, test.Replace) + got, err := RegexReplace(test.Input, test.Substr, test.Replace) if err != nil { t.Fatalf("unexpected error: %s", err) @@ -93,8 +93,8 @@ func TestRegexReplace(t *testing.T) { } } -func TestRegexReplace_invalid_regex(t *testing.T) { - _, err := RegexpReplace(cty.StringVal(""), cty.StringVal("("), cty.StringVal("")) +func TestRegexReplaceInvalidRegex(t *testing.T) { + _, err := RegexReplace(cty.StringVal(""), cty.StringVal("("), cty.StringVal("")) if err == nil { t.Fatal("expected an error") }