(testCase existsTestCase, t *testing.T)
| 76 | } |
| 77 | |
| 78 | func testExists(testCase existsTestCase, t *testing.T) { |
| 79 | defer func() { |
| 80 | for _, path := range []string{".devspace/generated.yaml"} { |
| 81 | os.Remove(path) |
| 82 | } |
| 83 | }() |
| 84 | for path, data := range testCase.files { |
| 85 | dataAsYaml, err := yaml.Marshal(data) |
| 86 | assert.NilError(t, err, "Error parsing data of file %s in testCase %s", path, testCase.name) |
| 87 | err = fsutil.WriteToFile([]byte(dataAsYaml), path) |
| 88 | assert.NilError(t, err, "Error writing file %s in testCase %s", path, testCase.name) |
| 89 | } |
| 90 | |
| 91 | loader := &configLoader{ |
| 92 | absConfigPath: testCase.configPath, |
| 93 | } |
| 94 | |
| 95 | exists := loader.Exists() |
| 96 | assert.Equal(t, exists, testCase.expectedanswer, "Unexpected answer in testCase %s", testCase.name) |
| 97 | } |
| 98 | |
| 99 | type cloneTestCase struct { |
| 100 | name string |
no test coverage detected