Skip to content

Commit 5924bb9

Browse files
authored
Merge pull request #208 from haskell/test-gen-files
Generate test files in test suite.
2 parents 1aff15c + 7c10d3e commit 5924bb9

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ myhist
99

1010
# IDEs
1111
.vscode
12+
13+
# Test suite
14+
tests/dummy-μασ

haskeline.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tested-with:
3535
GHC == 8.2.2
3636
GHC == 8.0.2
3737

38-
extra-source-files: examples/Test.hs Changelog tests/dummy-μασ/bar tests/dummy-μασ/ςερτ
38+
extra-source-files: examples/Test.hs Changelog
3939

4040
source-repository head
4141
type: git
@@ -154,6 +154,7 @@ test-suite haskeline-tests
154154
base >= 4.9 && < 4.23
155155
, containers >= 0.4 && < 0.9
156156
, bytestring >= 0.9 && < 0.13
157+
, directory
157158
, process >= 1.0 && < 1.7
158159
-- dependencies for test-suite
159160
, HUnit

tests/Unit.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Data.Word
1616
import qualified Data.Text as T
1717
import qualified Data.Text.Encoding as E
1818
import Data.Monoid ((<>))
19+
import System.Directory (createDirectoryIfMissing)
1920
import System.Exit (exitFailure)
2021
import System.Process (readProcess)
2122
import Test.HUnit
@@ -34,6 +35,13 @@ legacyEncoding = False
3435
whenLegacy :: BC.ByteString -> BC.ByteString
3536
whenLegacy s = if legacyEncoding then s else B.empty
3637

38+
-- These files are used to test tab completion.
39+
makeTestFiles :: IO ()
40+
makeTestFiles = do
41+
createDirectoryIfMissing True "tests/dummy-μασ"
42+
writeFile "tests/dummy-μασ/bar" ""
43+
writeFile "tests/dummy-μασ/ςερτ" ""
44+
3745
main :: IO ()
3846
main = do
3947
-- forkProcess needs an absolute path to the binary.
@@ -45,6 +53,7 @@ main = do
4553
runInTTY = True,
4654
environment = []
4755
}
56+
makeTestFiles
4857
result <- runTestTT $ test [interactionTests i, fileStyleTests i]
4958
when (errors result > 0 || failures result > 0) exitFailure
5059

tests/dummy-μασ/bar

Whitespace-only changes.

tests/dummy-μασ/ςερτ

Whitespace-only changes.

0 commit comments

Comments
 (0)