From 0c79e536ba4ee1662393f82caa6eda4e3d6d5f26 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Mon, 25 Nov 2019 12:01:34 -0500
Subject: [PATCH] some comments

---
 test/Persistence.hs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/test/Persistence.hs b/test/Persistence.hs
index 9ecb70e..794e9ef 100644
--- a/test/Persistence.hs
+++ b/test/Persistence.hs
@@ -52,19 +52,24 @@ tests = testGroup "Persistence"
   , sqlite3DatabaseVoucherPaymentTests
   ]
 
+-- Some dummy values that should be replaced by the use of QuickCheck.
 voucher = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
 fingerprint = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
 
+-- Mock a successful payment.
 paySuccessfully :: IO ()
 paySuccessfully = return ()
 
+-- Mock a failed payment.
 failPayment :: IO ()
 failPayment = throwIO ArbitraryException
 
+-- | Create a group of tests related to voucher payment and redemption.
 makeVoucherPaymentTests
   :: VoucherDatabase d
-  => Text.Text
-  -> IO d
+  => Text.Text           -- ^ A distinctive identifier for this group's label.
+  -> IO d                -- ^ An operation that creates a new, empty voucher
+                         -- database.
   -> TestTree
 makeVoucherPaymentTests label makeDatabase =
   testGroup ("voucher payments (" ++ Text.unpack label ++ ")")
@@ -109,10 +114,11 @@ makeVoucherPaymentTests label makeDatabase =
       assertEqual "redeeming double-paid voucher" (Right ()) redeemResult
   ]
 
-
+-- | Instantiate the persistence tests for the memory backend.
 memoryDatabaseVoucherPaymentTests :: TestTree
 memoryDatabaseVoucherPaymentTests = makeVoucherPaymentTests "memory" memory
 
+-- | Instantiate the persistence tests for the sqlite3 backend.
 sqlite3DatabaseVoucherPaymentTests :: TestTree
 sqlite3DatabaseVoucherPaymentTests =
   makeVoucherPaymentTests "sqlite3" $
-- 
GitLab