forked from GitHub/gf-core
Add more test cases for read/boot failures, those which incorrectly fail are commented out
This commit is contained in:
@@ -4,12 +4,6 @@ import Test.HUnit
|
|||||||
import PGF2
|
import PGF2
|
||||||
|
|
||||||
main = do
|
main = do
|
||||||
x <- testLoadFailure "non-existing.pgf"
|
|
||||||
y <- testLoadFailure "tests/basic.gf"
|
|
||||||
gr1 <- readPGF "tests/basic.pgf"
|
|
||||||
gr2 <- bootNGF "tests/basic.pgf" "tests/basic.ngf"
|
|
||||||
gr3 <- readNGF "tests/basic.ngf"
|
|
||||||
|
|
||||||
g <- newStdGen
|
g <- newStdGen
|
||||||
let
|
let
|
||||||
limit = 10 ^ 100
|
limit = 10 ^ 100
|
||||||
@@ -75,18 +69,43 @@ main = do
|
|||||||
,TestCase (assertEqual "unicode names 4" (Just "'а\\'б'") (fmap (showExpr []) (readExpr "'а\\'б'")))
|
,TestCase (assertEqual "unicode names 4" (Just "'а\\'б'") (fmap (showExpr []) (readExpr "'а\\'б'")))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
gr1 <- readPGF "tests/basic.pgf"
|
||||||
|
gr2 <- bootNGF "tests/basic.pgf" "tests/basic.ngf"
|
||||||
|
gr3 <- readNGF "tests/basic.ngf"
|
||||||
|
|
||||||
|
rp1 <- testLoadFailure (readPGF "non-existing.pgf")
|
||||||
|
rp2 <- testLoadFailure (readPGF "tests/basic.gf")
|
||||||
|
-- rp3 <- testLoadFailure (readPGF "tests/basic.ngf")
|
||||||
|
|
||||||
|
bn1 <- testLoadFailure (bootNGF "non-existing.pgf" "non-existing.ngf")
|
||||||
|
bn2 <- testLoadFailure (bootNGF "tests/basic.gf" "tests/basic.ngf")
|
||||||
|
bn3 <- testLoadFailure (bootNGF "tests/basic.ngf" "tests/basic.pgf")
|
||||||
|
|
||||||
|
-- rn1 <- testLoadFailure (readNGF "non-existing.ngf")
|
||||||
|
-- rn2 <- testLoadFailure (readNGF "tests/basic.gf")
|
||||||
|
-- rn3 <- testLoadFailure (readNGF "tests/basic.pgf")
|
||||||
|
|
||||||
runTestTTAndExit $
|
runTestTTAndExit $
|
||||||
TestList $
|
TestList $
|
||||||
[TestCase (assertBool "missing file" x)
|
[TestCase (assertBool "missing file" rp1)
|
||||||
,TestCase (assertBool "frong file format" y)
|
,TestCase (assertBool "wrong file format (GF)" rp2)
|
||||||
|
-- ,TestCase (assertBool "wrong file format (NGF)" rp3)
|
||||||
|
|
||||||
|
,TestCase (assertBool "missing file" bn1)
|
||||||
|
,TestCase (assertBool "wrong file format (GF)" bn2)
|
||||||
|
,TestCase (assertBool "wrong file format (NGF)" bn3)
|
||||||
|
|
||||||
|
-- ,TestCase (assertBool "missing file" rn1)
|
||||||
|
-- ,TestCase (assertBool "wrong file format (GF)" rn2)
|
||||||
|
-- ,TestCase (assertBool "wrong file format (PGF)" rn3)
|
||||||
]
|
]
|
||||||
++ grammarTests gr1
|
++ grammarTests gr1
|
||||||
++ grammarTests gr2
|
++ grammarTests gr2
|
||||||
++ grammarTests gr3
|
++ grammarTests gr3
|
||||||
|
|
||||||
|
|
||||||
testLoadFailure fpath = do
|
testLoadFailure io = do
|
||||||
res <- try (readPGF fpath)
|
res <- try io
|
||||||
case res :: Either SomeException PGF of
|
case res :: Either SomeException PGF of
|
||||||
Left _ -> return True
|
Left _ -> return True
|
||||||
Right _ -> return False
|
Right _ -> return False
|
||||||
|
|||||||
Reference in New Issue
Block a user