diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-09-26 21:36:32 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-09-26 21:36:32 +0400 |
commit | efc54d7c09e4e018c3729f2144a7fade49360f56 (patch) | |
tree | a28e2f6d49fdb1904354432a926111e1dca1b4de | |
parent | 214e969577c2ad104bd052ec699ecd950f2f445f (diff) |
Ignore error if character is out of base32 alphabet
3.3. Interpretation of Non-Alphabet Characters in Encoded Data
-rw-r--r-- | tests/Data/ByteString/Base32Spec.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/Data/ByteString/Base32Spec.hs b/tests/Data/ByteString/Base32Spec.hs index 3c646e2..ff3e13c 100644 --- a/tests/Data/ByteString/Base32Spec.hs +++ b/tests/Data/ByteString/Base32Spec.hs | |||
@@ -2,6 +2,7 @@ | |||
2 | module Data.ByteString.Base32Spec (spec) where | 2 | module Data.ByteString.Base32Spec (spec) where |
3 | 3 | ||
4 | import Control.Applicative | 4 | import Control.Applicative |
5 | import Control.Exception | ||
5 | import Data.ByteString as BS | 6 | import Data.ByteString as BS |
6 | import Data.ByteString.Internal as BS | 7 | import Data.ByteString.Internal as BS |
7 | import Data.ByteString.Base32 as Base32 | 8 | import Data.ByteString.Base32 as Base32 |
@@ -43,4 +44,8 @@ spec = do | |||
43 | it "inverse for encode" $ property $ \bs -> | 44 | it "inverse for encode" $ property $ \bs -> |
44 | decode (encode bs) == bs | 45 | decode (encode bs) == bs |
45 | 46 | ||
47 | it "fail gracefully if encoded data contains non alphabet chars" $ do | ||
48 | evaluate (decode "0=======") `shouldThrow` anyErrorCall | ||
49 | evaluate (decode "AAAAAAAA0=======") `shouldThrow` anyErrorCall | ||
50 | |||
46 | -- describe "decodeLenient" $ do | 51 | -- describe "decodeLenient" $ do |