<commit_before>{-# LANGUAGE OverloadedStrings #-}

module WithApplicationSpec where

import           Control.Concurrent
import           Control.Exception
import           Network.HTTP.Types
import           Network.Socket
import           Network.Wai
import           System.Environment
import           System.IO
import           System.IO.Silently
import           System.Process
import           Test.Hspec

import           Network.Wai.Handler.Warp.WithApplication

spec :: Spec
spec = do
  runIO $ do
      unsetEnv "http_proxy"
      unsetEnv "https_proxy"
  describe "withApplication" $ do
    it "runs a wai Application while executing the given action" $ do
      let mkApp = return $ \ _request respond -> respond $ responseLBS ok200 [] "foo"
      withApplication mkApp $ \ port -> do
        output <- readProcess "curl" ["-s", "localhost:" ++ show port] ""
        output `shouldBe` "foo"
<commit_msg>removing unnecessary imports.<commit_after>{-# LANGUAGE OverloadedStrings #-}

module WithApplicationSpec where

import           Control.Exception
import           Network.HTTP.Types
import           Network.Wai
import           System.Environment
import           System.IO
import           System.IO.Silently
import           System.Process
import           Test.Hspec

import           Network.Wai.Handler.Warp.WithApplication

spec :: Spec
spec = do
  runIO $ do
      unsetEnv "http_proxy"
      unsetEnv "https_proxy"
  describe "withApplication" $ do
    it "runs a wai Application while executing the given action" $ do
      let mkApp = return $ \ _request respond -> respond $ responseLBS ok200 [] "foo"
      withApplication mkApp $ \ port -> do
        output <- readProcess "curl" ["-s", "localhost:" ++ show port] ""
        output `shouldBe` "foo"

{'fraction_non_alphanumeric': 0.08258426966292134, 'fraction_numerical': 0.0033707865168539327, 'mean_word_length': 2.3227611940298507, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4491178', 'n_tokens_mistral': 479, 'n_tokens_neox': 472, 'n_words': 148}