File: Tests.hs

package info (click to toggle)
haskell-feed 1.3.2.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 820 kB
  • sloc: haskell: 4,735; xml: 4,315; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 962 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Text.RSS.Tests
  ( rssTests
  ) where

import Prelude.Compat

import Data.Maybe (isJust)
import Test.Framework (Test, mutuallyExclusive, testGroup)
import Test.Framework.Providers.HUnit (testCase)
import Test.HUnit (Assertion, assertBool)
import Text.RSS.Export.Tests (rssExportTests)
import Text.RSS.Import.Tests (rssImportTests)
import Text.XML

import Text.Feed.Export
import Text.Feed.Import
import Text.RSS.Utils

import Paths_feed

rssTests :: Test
rssTests =
  testGroup
    "Text.RSS"
    [mutuallyExclusive $ testGroup "RSS" [rssExportTests, rssImportTests, testFullRss20Parse]]

testFullRss20Parse :: Test
testFullRss20Parse = testCase "parse a complete rss 2.0 file" testRss20
  where
    testRss20 :: Assertion
    testRss20 = do
      contents <- parseFeedFromFile =<< getDataFileName "tests/files/rss20.xml"
      let res = fmap (renderText def) . (>>= elementToDoc) . fmap xmlFeed $ contents
      assertBool "RSS 2.0 Parsing" $ isJust res