implemented toBytes
This commit is contained in:
@@ -23,6 +23,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
module Data.CSV.SlurpSpec (spec) where
|
||||
|
||||
import Conduit (runConduit, (.|))
|
||||
import Data.Char (ord)
|
||||
import Data.Conduit.List (consume, sourceList)
|
||||
import Test.Hspec (Spec, context, describe, it, shouldBe, xit)
|
||||
|
||||
@@ -33,6 +34,7 @@ spec = describe "Data.CSV.Slurp" $ do
|
||||
decodeRowsSpec
|
||||
decodeRawRowsSpec
|
||||
decodeUTF8Spec
|
||||
toBytesSpec
|
||||
|
||||
decodeRowsSpec :: Spec
|
||||
decodeRowsSpec = describe "decodeRows" $ mapM_
|
||||
@@ -199,4 +201,12 @@ decodeUTF8Spec = describe "decodeUTF8" $ mapM_
|
||||
, ( "blank", "", Just "" )
|
||||
]
|
||||
|
||||
toBytesSpec :: Spec
|
||||
toBytesSpec = describe "toBytes" $ let
|
||||
input = ["ab", "cd"]
|
||||
expected = map (fromIntegral . ord) "abcd"
|
||||
in it ("should be " ++ show expected) $ do
|
||||
result <- runConduit $ sourceList input .| toBytes .| consume
|
||||
result `shouldBe` expected
|
||||
|
||||
--jl
|
||||
|
||||
Reference in New Issue
Block a user