// SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved. // SPDX-License-Identifier: Apache-2.0 package parser // import "miniflux.app/v2/internal/reader/parser" import ( "testing" ) func TestDetectRDF(t *testing.T) { data := `` format := DetectFeedFormat(data) if format != FormatRDF { t.Errorf(`Wrong format detected: %q instead of %q`, format, FormatRDF) } } func TestDetectRSS(t *testing.T) { data := `` format := DetectFeedFormat(data) if format != FormatRSS { t.Errorf(`Wrong format detected: %q instead of %q`, format, FormatRSS) } } func TestDetectAtom10(t *testing.T) { data := `` format := DetectFeedFormat(data) if format != FormatAtom { t.Errorf(`Wrong format detected: %q instead of %q`, format, FormatAtom) } } func TestDetectAtom03(t *testing.T) { data := `` format := DetectFeedFormat(data) if format != FormatAtom { t.Errorf(`Wrong format detected: %q instead of %q`, format, FormatAtom) } } func TestDetectAtomWithISOCharset(t *testing.T) { data := `` format := DetectFeedFormat(data) if format != FormatAtom { t.Errorf(`Wrong format detected: %q instead of %q`, format, FormatAtom) } } func TestDetectJSON(t *testing.T) { data := ` { "version" : "https://jsonfeed.org/version/1", "title" : "Example" } ` format := DetectFeedFormat(data) if format != FormatJSON { t.Errorf(`Wrong format detected: %q instead of %q`, format, FormatJSON) } } func TestDetectUnknown(t *testing.T) { data := ` ` format := DetectFeedFormat(data) if format != FormatUnknown { t.Errorf(`Wrong format detected: %q instead of %q`, format, FormatUnknown) } }