github.com/avenga/couper@v1.12.2/config/configload/error_handler_test.go (about) 1 package configload 2 3 import ( 4 "fmt" 5 "strings" 6 "testing" 7 8 "github.com/hashicorp/hcl/v2" 9 "github.com/hashicorp/hcl/v2/hclsyntax" 10 ) 11 12 func TestErrorHandler_newKindsFromLabels(t *testing.T) { 13 b := &hclsyntax.Block{ 14 Labels: []string{""}, 15 LabelRanges: []hcl.Range{ 16 { 17 Start: hcl.Pos{ 18 Line: 123, 19 Column: 321, 20 }, 21 End: hcl.Pos{ 22 Line: 123, 23 Column: 323, 24 }, 25 }, 26 }, 27 } 28 29 _, err := newKindsFromLabels(b, true) 30 31 exp := `message:":123,321-323: empty error_handler label; ", synopsis:"configuration error"` 32 if got := fmt.Sprintf("%#v", err); !strings.Contains(got, exp) { 33 t.Errorf("Unexpected error message given: %s", got) 34 } 35 }