Permalink
Browse files

Revert "test copies "test/inputFile"."

This reverts commit 4b0a5ef.
  • Loading branch information...
1 parent 3f38104 commit 1d6722f842dc4b5ce92eb6c5d4ba6f5e134875a2 @kazu-yamamoto committed Dec 11, 2012
Showing with 8 additions and 37 deletions.
  1. +2 −1 simple-sendfile.cabal
  2. +2 −36 test/SendfileSpec.hs
  3. +1 −0 test/Spec.hs
  4. +3 −0 test/setup.sh
View
@@ -46,8 +46,9 @@ Test-Suite spec
Type: exitcode-stdio-1.0
Default-Language: Haskell2010
Hs-Source-Dirs: test
- Main-Is: SendfileSpec.hs
+ Main-Is: Spec.hs
GHC-Options: -Wall
+ Other-Modules: SendfileSpec
Build-Depends: base
, HUnit
, bytestring
View
@@ -1,12 +1,11 @@
{-# LANGUAGE OverloadedStrings #-}
-module Main where
+module SendfileSpec where
import Control.Concurrent
import Control.Exception
import Control.Monad
-import Data.ByteString (ByteString)
-import qualified Data.ByteString.Char8 as BS
+import Data.ByteString.Char8 as BS
import Data.Conduit
import Data.Conduit.Binary as CB
import Data.Conduit.List as CL
@@ -24,16 +23,10 @@ import Test.Hspec
----------------------------------------------------------------
-main :: IO ()
-main = do
- setup0
- hspec spec
-
spec :: Spec
spec = do
describe "sendfile" $ do
it "sends an entire file" $ do
- setup0
sendFile EntireFile `shouldReturn` ExitSuccess
it "sends a part of file" $ do
sendFile (PartOfFile 2000 1000000) `shouldReturn` ExitSuccess
@@ -222,30 +215,3 @@ sinkAppendFile :: MonadResource m
=> FilePath
-> Sink ByteString m ()
sinkAppendFile fp = sinkIOHandle (openBinaryFile fp AppendMode)
-
-----------------------------------------------------------------
-
-srcFile :: String
-srcFile = "/usr/share/dict/words"
-
-dstFile :: String
-dstFile = "test/inputFile"
-
-setup0 :: IO ()
-setup0 = do
- dst <- doesFileExist dstFile
- unless dst $ do
- src <- doesFileExist srcFile
- if src then do
- size <- getFileSize srcFile
- if size >= 1000000 then
- copyFile srcFile dstFile
- else
- failure
- else
- failure
- where
- getFileSize file = bracket (openFile file ReadMode) hClose hFileSize
- failure = do
- hPutStrLn stderr "You must copy a large file (> 1000000 bytes) to \"test/inputFile\"."
- exitFailure
View
@@ -0,0 +1 @@
+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
View
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+ln -s /usr/share/dict/words inputFile

0 comments on commit 1d6722f

Please sign in to comment.