MCPcopy Index your code
hub / github.com/docker/docker-agent / TestScalarStringEdgeCases

Function TestScalarStringEdgeCases

pkg/modelerrors/modelerrors_test.go:912–937  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

910}
911
912func TestScalarStringEdgeCases(t *testing.T) {
913 t.Parallel()
914
915 tests := []struct {
916 name string
917 input any
918 expected string
919 }{
920 {name: "nil", input: nil, expected: ""},
921 {name: "empty string", input: "", expected: ""},
922 {name: "normal string", input: "test", expected: "test"},
923 {name: "whole number", input: float64(400), expected: "400"},
924 {name: "decimal number", input: float64(3.14), expected: "3.14"},
925 {name: "negative whole", input: float64(-500), expected: "-500"},
926 {name: "zero", input: float64(0), expected: "0"},
927 {name: "bool true", input: true, expected: "true"},
928 {name: "bool false", input: false, expected: "false"},
929 }
930
931 for _, tt := range tests {
932 t.Run(tt.name, func(t *testing.T) {
933 t.Parallel()
934 assert.Equal(t, tt.expected, scalarString(tt.input))
935 })
936 }
937}

Callers

nothing calls this directly

Calls 2

scalarStringFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected