github.com/adrian-bl/terraform@v0.7.0-rc2.0.20160705220747-de0a34fc3517/terraform/transform_transitive_reduction_test.go (about) 1 package terraform 2 3 import ( 4 "strings" 5 "testing" 6 ) 7 8 func TestTransitiveReductionTransformer(t *testing.T) { 9 mod := testModule(t, "transform-trans-reduce-basic") 10 11 g := Graph{Path: RootModulePath} 12 { 13 tf := &ConfigTransformer{Module: mod} 14 if err := tf.Transform(&g); err != nil { 15 t.Fatalf("err: %s", err) 16 } 17 } 18 19 { 20 transform := &TransitiveReductionTransformer{} 21 if err := transform.Transform(&g); err != nil { 22 t.Fatalf("err: %s", err) 23 } 24 } 25 26 actual := strings.TrimSpace(g.String()) 27 expected := strings.TrimSpace(testTransformTransReduceBasicStr) 28 if actual != expected { 29 t.Fatalf("bad:\n\n%s", actual) 30 } 31 } 32 33 const testTransformTransReduceBasicStr = ` 34 aws_instance.A 35 aws_instance.B 36 aws_instance.A 37 aws_instance.C 38 aws_instance.B 39 `