MCPcopy
hub / github.com/kptdev/kpt / ReplaceDIRMacro

Method ReplaceDIRMacro

internal/cmdexport/cmdexport_test.go:348–364  ·  view source on GitHub ↗

ReplaceDIRMacro replaces all `{DIR}` macros in params with cwd.

()

Source from the content-addressed store, hash-verified

346
347// ReplaceDIRMacro replaces all `{DIR}` macros in params with cwd.
348func (t *TestCase) ReplaceDIRMacro() error {
349 cwd, err := os.Getwd()
350 if err != nil {
351 return err
352 }
353
354 var params []string
355 for _, param := range t.params {
356 param = strings.ReplaceAll(param, "{DIR}", cwd)
357
358 params = append(params, param)
359 }
360
361 t.params = params
362
363 return nil
364}
365
366func setupTempDir(files files) (dir string, err error) {
367 tempDir, err := ioutil.TempDir("", "kpt-fn-export-test")

Callers 1

TestCmdExportFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected