summaryrefslogtreecommitdiff
path: root/tests/suite.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/suite.hs')
-rw-r--r--tests/suite.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/suite.hs b/tests/suite.hs
index 3a7b7eb..a8b5a30 100644
--- a/tests/suite.hs
+++ b/tests/suite.hs
@@ -67,25 +67,25 @@ testArmorEncode :: [FilePath] -> FilePath -> Assertion
67testArmorEncode fps target = do 67testArmorEncode fps target = do
68 bss <- mapM (\fp -> BL.readFile $ "tests/data/" ++ fp) fps 68 bss <- mapM (\fp -> BL.readFile $ "tests/data/" ++ fp) fps
69 tbs <- BL.readFile $ "tests/data/" ++ target 69 tbs <- BL.readFile $ "tests/data/" ++ target
70 assertEqual ("literaldata") tbs (encodeLazy (map (\bs -> Armor ArmorMessage [("Version","OpenPrivacy 0.99")] bs) bss)) 70 assertEqual "literaldata" tbs (encodeLazy (map (Armor ArmorMessage [("Version","OpenPrivacy 0.99")]) bss))
71 71
72testClearsignedEncode :: FilePath -> FilePath -> FilePath -> Assertion 72testClearsignedEncode :: FilePath -> FilePath -> FilePath -> Assertion
73testClearsignedEncode ftxt fsig ftarget = do 73testClearsignedEncode ftxt fsig ftarget = do
74 txt <- BL.readFile $ "tests/data/" ++ ftxt 74 txt <- BL.readFile $ "tests/data/" ++ ftxt
75 sig <- BL.readFile $ "tests/data/" ++ fsig 75 sig <- BL.readFile $ "tests/data/" ++ fsig
76 target <- BL.readFile $ "tests/data/" ++ ftarget 76 target <- BL.readFile $ "tests/data/" ++ ftarget
77 assertEqual ("clearsigned encode") target (encodeLazy [ClearSigned [("Hash","SHA1")] txt (Armor ArmorSignature [("Version","OpenPrivacy 0.99")] sig)]) 77 assertEqual "clearsigned encode" target (encodeLazy [ClearSigned [("Hash","SHA1")] txt (Armor ArmorSignature [("Version","OpenPrivacy 0.99")] sig)])
78 78
79testStrictDecode :: FilePath -> Assertion 79testStrictDecode :: FilePath -> Assertion
80testStrictDecode fp = do 80testStrictDecode fp = do
81 bs <- BL.readFile $ "tests/data/" ++ fp 81 bs <- BL.readFile $ "tests/data/" ++ fp
82 assertEqual ("strict decode") (decodeLazy bs :: Either String [Armor]) (decode (B.concat . BL.toChunks $ bs) :: Either String [Armor]) 82 assertEqual "strict decode" (decodeLazy bs :: Either String [Armor]) (decode (B.concat . BL.toChunks $ bs) :: Either String [Armor])
83 83
84testStrictEncode :: FilePath -> Assertion 84testStrictEncode :: FilePath -> Assertion
85testStrictEncode fp = do 85testStrictEncode fp = do
86 bs <- BL.readFile $ "tests/data/" ++ fp 86 bs <- BL.readFile $ "tests/data/" ++ fp
87 let fakearmors = [Armor ArmorMessage [("Version","OpenPrivacy 0.99")] bs, ClearSigned [("Hash","SHA1")] bs (Armor ArmorSignature [("Version","OpenPrivacy 0.99")] bs)] 87 let fakearmors = [Armor ArmorMessage [("Version","OpenPrivacy 0.99")] bs, ClearSigned [("Hash","SHA1")] bs (Armor ArmorSignature [("Version","OpenPrivacy 0.99")] bs)]
88 assertEqual ("strict encode") (encodeLazy fakearmors) (BL.fromChunks [(encode fakearmors)]) 88 assertEqual "strict encode" (encodeLazy fakearmors) (BL.fromChunks [encode fakearmors])
89 89
90tests :: TestTree 90tests :: TestTree
91tests = testGroup "openpgp-asciiarmor" [ 91tests = testGroup "openpgp-asciiarmor" [