MCPcopy Create free account
hub / github.com/aws-cloudformation/rain / runTest

Function runTest

cft/pkg/module_test.go:221–251  ·  view source on GitHub ↗
(test string, t *testing.T)

Source from the content-addressed store, hash-verified

219}
220
221func runTest(test string, t *testing.T) {
222
223 // There should be 3 files for each test, for example:
224 // bucket-module.yaml, bucket-template.yaml, bucket-expect.yaml
225
226 path := fmt.Sprintf("./tmpl/%v-expect.yaml", test)
227
228 expectedTemplate, err := parse.File(path)
229 if err != nil {
230 t.Errorf("expected %s: %v", test, err)
231 return
232 }
233
234 pkg.Experimental = true
235
236 packaged, err := pkg.File(fmt.Sprintf("./tmpl/%v-template.yaml", test))
237 if err != nil {
238 t.Errorf("packaged %s: %v", test, err)
239 return
240 }
241
242 //y := format.String(packaged, format.Options{
243 // JSON: false,
244 // Unsorted: false,
245 //})
246
247 d := diff.New(packaged, expectedTemplate)
248 if d.Mode() != "=" {
249 t.Errorf("Module test %s failed: %v", test, d.Format(true))
250 }
251}
252
253// runFailTest should fail to package
254func runFailTest(test string, t *testing.T) {

Callers 15

TestModuleFunction · 0.85
TestBucketFunction · 0.85
TestApiFunction · 0.85
TestSimpleFunction · 0.85
TestModInModFunction · 0.85
TestSubFunction · 0.85
TestManyFunction · 0.85
TestRefFunction · 0.85
TestMetaFunction · 0.85
TestRefFalseFunction · 0.85
TestPackageAliasFunction · 0.85
TestIfPAramFunction · 0.85

Calls 5

FileFunction · 0.92
FileFunction · 0.92
NewFunction · 0.92
ModeMethod · 0.65
FormatMethod · 0.65

Tested by

no test coverage detected