From bbd3f429da0e9e5906f6aecb85f1c00683500428 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 10 Jul 2013 14:00:31 -0400 Subject: [PATCH] Use hyphens instead of underscores in access-token et al. Replace HTML entities once more. --- src/CommandLine.hs | 18 +++++++++--------- src/StringUtils.hs | 3 ++- src/Twitter/Status.hs | 3 ++- test/TestSuite.hs | 6 +++--- twat.cabal | 1 + 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 39ff5b2..f215ab8 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -59,23 +59,23 @@ default_options = Options { opt_access_token = Nothing, options :: [OptDescr (Options -> IO Options)] options = [ Option - [] ["consumer_key"] - (ReqArg set_consumer_key "consumer_key") + [] ["consumer-key"] + (ReqArg set_consumer_key "consumer-key") "Your Twitter API consumer key.", Option - [] ["consumer_secret"] - (ReqArg set_consumer_secret "consumer_secret") + [] ["consumer-secret"] + (ReqArg set_consumer_secret "consumer-secret") "Your Twitter API consumer secret.", Option - [] ["access_token"] - (ReqArg set_access_token "access_token") + [] ["access-token"] + (ReqArg set_access_token "access-token") "Your Twitter API access token.", Option - [] ["access_secret"] - (ReqArg set_access_secret "access_secret") + [] ["access-secret"] + (ReqArg set_access_secret "access-secret") "Your Twitter API access secret.", Option @@ -180,7 +180,7 @@ set_from arg opts = do -- | The usage header. usage :: String -usage = "Usage: twat --consumer_key= --consumer_secret= --access_token= --access_secret= [-n heartbeat] [-t to_address] [-f from_address] [-s path-to-sendmail] [username2, [username3]...]" +usage = "Usage: twat --consumer-key= --consumer-secret= --access-token= --access-secret= [-n heartbeat] [-t to_address] [-f from_address] [-s path-to-sendmail] [username2, [username3]...]" -- | Was the help option passed? diff --git a/src/StringUtils.hs b/src/StringUtils.hs index 52b1def..b5feccb 100644 --- a/src/StringUtils.hs +++ b/src/StringUtils.hs @@ -27,7 +27,8 @@ string_utils_tests = [ test_listify ] test_listify :: Test test_listify = - TestCase $ assertEqual "All items are numbered correctly." expected_items actual_items + TestCase $ assertEqual description expected_items actual_items where + description = "All items are numbered correctly." actual_items = listify [ "item1", "item2" ] expected_items = ["1. item1", "2. item2" ] diff --git a/src/Twitter/Status.hs b/src/Twitter/Status.hs index 6ff7e6c..176619d 100644 --- a/src/Twitter/Status.hs +++ b/src/Twitter/Status.hs @@ -19,6 +19,7 @@ import System.Locale (defaultTimeLocale, rfc822DateFormat) import Test.HUnit import Text.Regex (matchRegex, mkRegex) +import Html (replace_entities) import StringUtils (listify) import Twitter.User @@ -40,7 +41,7 @@ instance FromJSON Status where (t .: id_field) <*> liftM isJustInt (t .: in_reply_to_status_id_field) <*> (t .: retweeted_field) <*> - (t .: text_field) <*> + liftM replace_entities (t .: text_field) <*> (t .: user_field) where -- The typechecker flips out without this. diff --git a/test/TestSuite.hs b/test/TestSuite.hs index f583ca1..4fa222d 100644 --- a/test/TestSuite.hs +++ b/test/TestSuite.hs @@ -2,14 +2,14 @@ import Test.HUnit import StringUtils (string_utils_tests) import Twitter.Status(status_tests) -import Twitter.Xml(xml_tests) +import Html(html_tests) -- The list of HUnit tests. -test_suite = TestList (concat [xml_tests, status_tests, string_utils_tests]) +test_suite = TestList (concat [html_tests, status_tests, string_utils_tests]) main :: IO () main = do putStrLn "HUnit" putStrLn "-----" runTestTT test_suite - return () \ No newline at end of file + return () diff --git a/twat.cabal b/twat.cabal index 8a11081..5e04586 100644 --- a/twat.cabal +++ b/twat.cabal @@ -22,6 +22,7 @@ executable twat process == 1.*, old-locale == 1.*, regex-compat == 0.*, + tagsoup == 0.12.*, text == 0.11.*, time == 1.* -- 2.43.2