packages feed

keuringsdienst-1.0.0.11 / 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/>.-}module Keuringsdienst.HelpersSpec whereimport Data.Text as Timport Keuringsdienst as Kimport Keuringsdienst.Helpers as KHimport Test.HUnitkeuringsdienstHelpersSpec :: TestkeuringsdienstHelpersSpec =  TestList    [ context "is equal to rule will succeed with text" isEqualToRuleWillSucceedWithText,      context "is equal to rule will fail with text" isEqualToRuleWillFailWithText,      context "is not equal to rule will succeed with text" isNotEqualToRuleWillSucceedWithText,      context "is not equal to rule will fail with text" isNotEqualToRuleWillFailWithText    ]context :: String -> Test -> Testcontext = TestLabelsomeText :: TextsomeText = "Keuringsdienst van Waarde"isEqualToRuleWillSucceedWithText :: TestisEqualToRuleWillSucceedWithText =  TestCase (assertEqual "" K.Success systemUnderTest)  where    systemUnderTest :: ValidationResult    systemUnderTest = someText |?| isEqualTo someTextisEqualToRuleWillFailWithText :: TestisEqualToRuleWillFailWithText =  case systemUnderTest of    K.Failure _ -> TestCase (assertBool "" True)    K.Success -> error "Expected rule validation to return a failure"  where    systemUnderTest :: ValidationResult    systemUnderTest = T.take 1 someText |?| isEqualTo someTextisNotEqualToRuleWillSucceedWithText :: TestisNotEqualToRuleWillSucceedWithText =  TestCase (assertEqual "" K.Success systemUnderTest)  where    systemUnderTest :: ValidationResult    systemUnderTest = T.take 1 someText |?| isNotEqualTo someTextisNotEqualToRuleWillFailWithText :: TestisNotEqualToRuleWillFailWithText =  case systemUnderTest of    K.Failure _ -> TestCase (assertBool "" True)    K.Success -> error "Expected rule validation to return a failure"  where    systemUnderTest :: ValidationResult    systemUnderTest = someText |?| isNotEqualTo someText