{-# LANGUAGE FlexibleContexts #-}
module Main (main) where
import Text.HTML.Scalpel
import Control.Applicative
import System.Exit
import Test.HUnit
import qualified Text.HTML.TagSoup as TagSoup
import qualified Text.Regex.TDFA
main = exit . failures =<< runTestTT (TestList [
scrapeTests
, selectTests
, scrapeHtmlsTests
, scrapeHtmlTests
])
exit :: Int -> IO ()
exit 0 = exitSuccess
exit n = exitWith $ ExitFailure n
selectTests = "selectTests" ~: TestList [
selectTest
("a" @: [])
"foo"
["foo"]
, selectTest
("a" @: [])
"foobar"
["foo", "bar"]
, selectTest
("a" @: [])
"foo"
["foo"]
, selectTest
("a" @: [])
"foo"
["foo", "foo"]
, selectTest
("b" @: [])
"foo"
[]
, selectTest
("a" @: [])
"foo"
[""]
, selectTest
("a" @: ["key" @= "value"])
"foobar"
["bar"]
, selectTest
("a" // "b" @: [] // "c")
"