tests: Utils -> easytest
This commit is contained in:
		
							parent
							
								
									f713a413ff
								
							
						
					
					
						commit
						bbecb28cae
					
				| @ -18,10 +18,10 @@ tests_Hledger = TestList | |||||||
|      tests_Hledger_Data |      tests_Hledger_Data | ||||||
|     ,tests_Hledger_Query |     ,tests_Hledger_Query | ||||||
|     ,tests_Hledger_Reports |     ,tests_Hledger_Reports | ||||||
|     ,tests_Hledger_Utils |  | ||||||
|     ] |     ] | ||||||
| 
 | 
 | ||||||
| easytests_Hledger = tests "Hledger" [ | easytests_Hledger = tests "Hledger" [ | ||||||
|    easytests_Data |    easytests_Data | ||||||
|   ,easytests_Read |   ,easytests_Read | ||||||
|  |   ,easytests_Utils | ||||||
|   ] |   ] | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ Standard imports and utilities which are useful everywhere, or needed low | |||||||
| in the module hierarchy. This is the bottom of hledger's module graph. | in the module hierarchy. This is the bottom of hledger's module graph. | ||||||
| 
 | 
 | ||||||
| -} | -} | ||||||
|  | {-# LANGUAGE OverloadedStrings #-} | ||||||
| 
 | 
 | ||||||
| module Hledger.Utils (---- provide these frequently used modules - or not, for clearer api: | module Hledger.Utils (---- provide these frequently used modules - or not, for clearer api: | ||||||
|                           -- module Control.Monad, |                           -- module Control.Monad, | ||||||
| @ -216,6 +217,6 @@ sequence' ms = do | |||||||
| mapM' :: Monad f => (a -> f b) -> [a] -> f [b] | mapM' :: Monad f => (a -> f b) -> [a] -> f [b] | ||||||
| mapM' f = sequence' . map f | mapM' f = sequence' . map f | ||||||
| 
 | 
 | ||||||
| tests_Hledger_Utils = TestList [ | easytests_Utils = tests "Utils" [ | ||||||
|     tests_Hledger_Utils_Text |   easytests_Text | ||||||
|     ] |   ] | ||||||
|  | |||||||
| @ -54,7 +54,8 @@ module Hledger.Utils.Text | |||||||
|  -- fitStringMulti, |  -- fitStringMulti, | ||||||
|   textPadLeftWide, |   textPadLeftWide, | ||||||
|   textPadRightWide, |   textPadRightWide, | ||||||
|   tests_Hledger_Utils_Text |   -- -- * tests | ||||||
|  |   easytests_Text | ||||||
|   ) |   ) | ||||||
| where | where | ||||||
| 
 | 
 | ||||||
| @ -419,12 +420,14 @@ textWidth s = maximum $ map (T.foldr (\a b -> charWidth a + b) 0) $ T.lines s | |||||||
| --         | otherwise                        -> 1 | --         | otherwise                        -> 1 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| tests_Hledger_Utils_Text = TestList [ | easytests_Text = tests "Text" [ | ||||||
|       quoteIfSpaced "a'a" ~?= "a'a" |    tests "quoteIfSpaced" [ | ||||||
|     , quoteIfSpaced "a\"a" ~?= "a\"a" |      expectEq' "a'a" (quoteIfSpaced "a'a") | ||||||
|     , quoteIfSpaced "a a" ~?= "\"a a\"" |     ,expectEq' "a\"a" (quoteIfSpaced "a\"a")               | ||||||
|     , quoteIfSpaced "mimi's cafe" ~?= "\"mimi's cafe\"" |     ,expectEq' "\"a a\"" (quoteIfSpaced "a a")                | ||||||
|     , quoteIfSpaced "\"alex\" cafe" ~?= "\"\\\"alex\\\" cafe\"" |     ,expectEq' "\"mimi's cafe\"" (quoteIfSpaced "mimi's cafe")        | ||||||
|     , quoteIfSpaced "le'shan's cafe" ~?= "\"le'shan's cafe\"" |     ,expectEq' "\"\\\"alex\\\" cafe\"" (quoteIfSpaced "\"alex\" cafe")      | ||||||
|     , quoteIfSpaced "\"be'any's\" cafe" ~?= "\"\\\"be'any's\\\" cafe\"" |     ,expectEq' "\"le'shan's cafe\"" (quoteIfSpaced "le'shan's cafe")     | ||||||
|  |     ,expectEq' "\"\\\"be'any's\\\" cafe\"" (quoteIfSpaced "\"be'any's\" cafe")  | ||||||
|     ]  |     ]  | ||||||
|  |   ] | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user