github.com/docker-library/go-dockerlibrary@v0.0.0-20200821205225-669fbe5c1d52/manifest/parse_test.go (about) 1 package manifest_test 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/docker-library/go-dockerlibrary/manifest" 8 ) 9 10 func TestParseError(t *testing.T) { 11 invalidManifest := `this is just completely bogus and invalid no matter how you slice it` 12 13 man, err := manifest.Parse(strings.NewReader(invalidManifest)) 14 if err == nil { 15 t.Errorf("Expected error, got valid manifest instead:\n%s", man) 16 } 17 if !strings.HasPrefix(err.Error(), "Bad line:") { 18 t.Errorf("Unexpected error: %v", err) 19 } 20 }