MCPcopy Create free account
hub / github.com/github/gh-aw / TestSpec_PublicAPI_SanitizeParameterName

Function TestSpec_PublicAPI_SanitizeParameterName

pkg/stringutil/spec_test.go:490–502  ·  view source on GitHub ↗

TestSpec_PublicAPI_SanitizeParameterName validates the documented behavior of SanitizeParameterName as described in the package README.md. Specification: "Sanitizes a parameter name for use as a GitHub Actions output or environment variable name. Preserves letters, digits, $, and _, and replaces al

(t *testing.T)

Source from the content-addressed store, hash-verified

488// or environment variable name. Preserves letters, digits, $, and _, and replaces
489// all other characters with underscores."
490func TestSpec_PublicAPI_SanitizeParameterName(t *testing.T) {
491 t.Run("preserves letters digits underscores and $", func(t *testing.T) {
492 result := SanitizeParameterName("Hello_World$1")
493 assert.Equal(t, "Hello_World$1", result,
494 "letters, digits, _, and $ should be preserved")
495 })
496
497 t.Run("replaces other characters with underscores", func(t *testing.T) {
498 result := SanitizeParameterName("foo-bar.baz")
499 assert.Equal(t, "foo_bar_baz", result,
500 "non-preserved characters should be replaced with underscores")
501 })
502}
503
504// TestSpec_PublicAPI_SanitizePythonVariableName validates the documented behavior
505// of SanitizePythonVariableName as described in the package README.md.

Callers

nothing calls this directly

Calls 2

SanitizeParameterNameFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected