MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestInstallCmd_ValidateAndCleanInput

Function TestInstallCmd_ValidateAndCleanInput

cmds/cmd_install_command_test.go:80–184  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestInstallCmd_ValidateAndCleanInput(t *testing.T) {
81 // Cleanup.
82 dirs.RemoveAllForTest()
83
84 installCmd := &installCmd{}
85
86 tests := []struct {
87 name string
88 input string
89 expected string
90 expectError bool
91 }{
92 {
93 name: "valid package",
94 input: "opencv@4.8.0",
95 expected: "opencv@4.8.0",
96 expectError: false,
97 },
98 {
99 name: "valid package with spaces",
100 input: " opencv@4.8.0 ",
101 expected: "opencv@4.8.0",
102 expectError: false,
103 },
104 {
105 name: "valid package with windows escape",
106 input: "opencv`@4.8.0",
107 expected: "opencv@4.8.0",
108 expectError: false,
109 },
110 {
111 name: "complex version",
112 input: "boost@1.82.0-beta1",
113 expected: "boost@1.82.0-beta1",
114 expectError: false,
115 },
116 {
117 name: "empty input",
118 input: "",
119 expected: "",
120 expectError: true,
121 },
122 {
123 name: "whitespace only",
124 input: " ",
125 expected: "",
126 expectError: true,
127 },
128 {
129 name: "missing version",
130 input: "opencv",
131 expected: "",
132 expectError: true,
133 },
134 {
135 name: "missing package name",
136 input: "@4.8.0",
137 expected: "",

Callers

nothing calls this directly

Calls 2

validateAndCleanInputMethod · 0.95
RemoveAllForTestFunction · 0.92

Tested by

no test coverage detected