Skip to content

Commit 58c4676

Browse files
committed
Refactor SQLDB test specifications for improved readability and consistency
- Updated import statements for better organization and clarity in PostgresDBSpec.hs, QueryExamplesSpec.hs, and SQLiteDBSpec.hs. - Reformatted configuration definitions in PostgresDBSpec.hs and SQLiteDBSpec.hs for consistency. - Enhanced test descriptions and assertions for clarity in all test specifications. - Improved formatting of data structures and instances for better readability. - Ensured consistent use of line breaks and indentation across all test files.
1 parent 62531d6 commit 58c4676

84 files changed

Lines changed: 7177 additions & 6053 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Setup.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
import Distribution.Simple
2+
23
main = defaultMain

src/EulerHS/Api.hs

Lines changed: 132 additions & 118 deletions
Large diffs are not rendered by default.

src/EulerHS/BinaryString.hs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
module EulerHS.BinaryString
2-
( BinaryString(..)
3-
, LBinaryString(..)
4-
, base64Encode
5-
, base64Decode
6-
) where
2+
( BinaryString (..),
3+
LBinaryString (..),
4+
base64Encode,
5+
base64Decode,
6+
)
7+
where
78

89
import qualified Control.Monad.Fail as MonadFail
910
import qualified Data.ByteString as Strict
@@ -12,19 +13,18 @@ import qualified Data.ByteString.Lazy as Lazy
1213
import qualified Data.String.Conversions as Conversions
1314
import qualified Data.Text as Text
1415
import qualified Data.Text.Encoding as Encoding
15-
import EulerHS.Prelude
16-
import Text.Read (read)
16+
import EulerHS.Prelude
17+
import Text.Read (read)
1718

1819
-- TODO: Move to euler-db
1920

2021
--------------------------------------------------------------------------
2122
-- Base64 encoding/decoding helpers
2223
--------------------------------------------------------------------------
2324

24-
newtype BinaryString
25-
= BinaryString
26-
{ getBinaryString :: Strict.ByteString }
27-
deriving (Show, Eq, Ord)
25+
newtype BinaryString = BinaryString
26+
{getBinaryString :: Strict.ByteString}
27+
deriving (Show, Eq, Ord)
2828

2929
instance ToJSON BinaryString where
3030
toJSON val = toJSON ((show $ getBinaryString val) :: Text)
@@ -50,10 +50,9 @@ instance Conversions.ConvertibleStrings BinaryString Lazy.ByteString where
5050
-- Lazy BinaryString
5151
--------------------------------------------------------------------------
5252

53-
newtype LBinaryString
54-
= LBinaryString
55-
{ getLBinaryString :: Lazy.ByteString }
56-
deriving (Show, Eq, Ord)
53+
newtype LBinaryString = LBinaryString
54+
{getLBinaryString :: Lazy.ByteString}
55+
deriving (Show, Eq, Ord)
5756

5857
instance ToJSON LBinaryString where
5958
toJSON val = toJSON (show (getLBinaryString val) :: Text)
@@ -82,15 +81,13 @@ instance Conversions.ConvertibleStrings LBinaryString Strict.ByteString where
8281
-- | Base64 encode a bytestring
8382
--
8483
-- NOTE: Decoding to UTF-8 cannot fail so is safe
85-
--
8684
base64Encode :: Strict.ByteString -> Text.Text
8785
base64Encode = Encoding.decodeUtf8 . B64.encode
8886

8987
-- | Base64 decode a Base64-encoded string
9088
--
9189
-- NOTE: This may fail if the string is malformed using MonadFail
92-
--
9390
base64Decode :: MonadFail.MonadFail m => Text.Text -> m Strict.ByteString
9491
base64Decode s = case B64.decode (Encoding.encodeUtf8 s) of
95-
Left err -> fail err
92+
Left err -> fail err
9693
Right res -> return res

0 commit comments

Comments
 (0)