packages feed

himari-1.1.6.4: test/Spec/HlintUnliftioSpec.hs

module Spec.HlintUnliftioSpec (tests) where

import Himari
import HlintRunner
import Test.Sandwich

tests :: TopSpec
tests = do
  describe "hlint unliftio preference rules" . withSample "UnliftioPreference.hs" $ do
    describe "Control" $ do
      describe "Exception" $ do
        it "catch should warn to use UnliftIO.Exception" $
          shouldWarnFunction "badCatch" "Exception.catch" "UnliftIO.Exception.catch"

        it "bracket should warn to use UnliftIO.Exception" $
          shouldWarnFunction "badBracket" "Exception.bracket" "UnliftIO.Exception.bracket"

        it "finally should warn to use UnliftIO.Exception" $
          shouldWarnFunction "badFinally" "Exception.finally" "UnliftIO.Exception.finally"

        it "try should warn to use UnliftIO.Exception" $
          shouldWarnFunction "badTry" "Exception.try" "UnliftIO.Exception.try"

      describe "Concurrent.MVar" $ do
        it "withMVar should warn to use UnliftIO.MVar" $
          shouldWarnFunction "badWithMVar" "MVar.withMVar" "UnliftIO.MVar.withMVar"

        it "modifyMVar_ should warn to use UnliftIO.MVar" $
          shouldWarnFunction "badModifyMVar" "MVar.modifyMVar_" "UnliftIO.MVar.modifyMVar_"

    describe "System.Timeout" $ do
      it "timeout should warn to use UnliftIO.Timeout" $
        shouldWarnFunction "badTimeout" "Timeout.timeout" "UnliftIO.Timeout.timeout"