packages feed

keuringsdienst-0.1.0.5 / test / Keuringsdienst / HelpersSpec.hs

{-  Copyright © 2023 Josep Bigorra  This file is part of Keuringsdienst.  Keuringsdienst is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation,    either version 3 of the License, or (at your option) any later version.  Keuringsdienst is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.  You should have received a copy of the GNU General Public License along with Keuringsdienst.  If not, see <https://www.gnu.org/licenses/>.-}{-# OPTIONS_GHC -F -pgmF htfpp #-}module Keuringsdienst.HelpersSpec  ( htf_thisModulesTests,  )whereimport Data.Text as Timport Keuringsdienst as Kimport Keuringsdienst.Helpers as KHimport Test.Framework-- λ test helperssomeText :: TextsomeText = "Keuringsdienst van Waarde"-- λ test cases-- isEqualTotest_isEqualToRuleWillSucceedWithText :: IO ()test_isEqualToRuleWillSucceedWithText =  assertEqual K.Success systemUnderTest  where    systemUnderTest :: ValidationResult    systemUnderTest = someText |?| isEqualTo someTexttest_isEqualToRuleWillFailWithText :: IO ()test_isEqualToRuleWillFailWithText =  case systemUnderTest of    K.Failure _ -> pure ()    K.Success -> error "Expected rule validation to return a failure"  where    systemUnderTest :: ValidationResult    systemUnderTest = T.take 1 someText |?| isEqualTo someText-- isNotEqualTotest_isNotEqualToRuleWillSucceedWithText :: IO ()test_isNotEqualToRuleWillSucceedWithText =  assertEqual K.Success systemUnderTest  where    systemUnderTest :: ValidationResult    systemUnderTest = T.take 1 someText |?| isNotEqualTo someTexttest_isNotEqualToRuleWillFailWithText :: IO ()test_isNotEqualToRuleWillFailWithText =  case systemUnderTest of    K.Failure _ -> pure ()    K.Success -> error "Expected rule validation to return a failure"  where    systemUnderTest :: ValidationResult    systemUnderTest = someText |?| isNotEqualTo someText