1
Fork 0

use tasty for tests

This commit is contained in:
Jake Wheat 2015-07-31 12:45:51 +03:00
parent c156c5c34e
commit 1364c58534
4 changed files with 16 additions and 19 deletions

View file

@ -2,7 +2,7 @@ If you need help updating to a new version of simple-sql-parser,
please email jakewheatmail@gmail.com or use the github bug tracker, please email jakewheatmail@gmail.com or use the github bug tracker,
https://github.com/JakeWheat/simple-sql-parser/issues. https://github.com/JakeWheat/simple-sql-parser/issues.
0.4.1 (commit TBD) 0.4.1 (commit c156c5c34e91e1f7ef449d2c1ea14e282104fd90)
tested with ghc 7.4.2, 7.6.3, 7.8.4,7.10.0.20150123 tested with ghc 7.4.2, 7.6.3, 7.8.4,7.10.0.20150123
simple demonstration of how dialects could be handled internally simple demonstration of how dialects could be handled internally
add ability to add comments to syntax tree to help with generating add ability to add comments to syntax tree to help with generating

View file

@ -50,10 +50,8 @@ Test-Suite Tests
parsec >=3.1 && <3.2, parsec >=3.1 && <3.2,
mtl >=2.1 && <2.3, mtl >=2.1 && <2.3,
pretty >= 1.1 && < 1.2, pretty >= 1.1 && < 1.2,
tasty >= 0.10 && < 0.11,
HUnit >= 1.2 && < 1.3, tasty-hunit >= 0.9 && < 0.10
test-framework >= 0.8 && < 0.9,
test-framework-hunit >= 0.3 && < 0.4
Other-Modules: Language.SQL.SimpleSQL.Pretty, Other-Modules: Language.SQL.SimpleSQL.Pretty,
Language.SQL.SimpleSQL.Parser, Language.SQL.SimpleSQL.Parser,

View file

@ -9,9 +9,8 @@ test data to the Test.Framework tests.
> ,TestItem(..) > ,TestItem(..)
> ) where > ) where
> import Test.Framework > import qualified Test.Tasty as T
> import Test.Framework.Providers.HUnit > import qualified Test.Tasty.HUnit as H
> import qualified Test.HUnit as H
> --import Language.SQL.SimpleSQL.Syntax > --import Language.SQL.SimpleSQL.Syntax
> import Language.SQL.SimpleSQL.Pretty > import Language.SQL.SimpleSQL.Pretty
@ -50,15 +49,15 @@ order on the generated documentation.
> ,mySQLTests > ,mySQLTests
> ] > ]
> tests :: Test.Framework.Test > tests :: T.TestTree
> tests = itemToTest testData > tests = itemToTest testData
> --runTests :: IO () > --runTests :: IO ()
> --runTests = void $ H.runTestTT $ itemToTest testData > --runTests = void $ H.runTestTT $ itemToTest testData
> itemToTest :: TestItem -> Test.Framework.Test > itemToTest :: TestItem -> T.TestTree
> itemToTest (Group nm ts) = > itemToTest (Group nm ts) =
> testGroup nm $ map itemToTest ts > T.testGroup nm $ map itemToTest ts
> itemToTest (TestValueExpr d str expected) = > itemToTest (TestValueExpr d str expected) =
> toTest parseValueExpr prettyValueExpr d str expected > toTest parseValueExpr prettyValueExpr d str expected
> itemToTest (TestQueryExpr d str expected) = > itemToTest (TestQueryExpr d str expected) =
@ -81,8 +80,8 @@ order on the generated documentation.
> -> Dialect > -> Dialect
> -> String > -> String
> -> a > -> a
> -> Test.Framework.Test > -> T.TestTree
> toTest parser pp d str expected = testCase str $ do > toTest parser pp d str expected = H.testCase str $ do
> let egot = parser d "" Nothing str > let egot = parser d "" Nothing str
> case egot of > case egot of
> Left e -> H.assertFailure $ peFormattedError e > Left e -> H.assertFailure $ peFormattedError e
@ -103,8 +102,8 @@ order on the generated documentation.
> -> (Dialect -> a -> String) > -> (Dialect -> a -> String)
> -> Dialect > -> Dialect
> -> String > -> String
> -> Test.Framework.Test > -> T.TestTree
> toPTest parser pp d str = testCase str $ do > toPTest parser pp d str = H.testCase str $ do
> let egot = parser d "" Nothing str > let egot = parser d "" Nothing str
> case egot of > case egot of
> Left e -> H.assertFailure $ peFormattedError e > Left e -> H.assertFailure $ peFormattedError e
@ -123,8 +122,8 @@ order on the generated documentation.
> -> (Dialect -> a -> String) > -> (Dialect -> a -> String)
> -> Dialect > -> Dialect
> -> String > -> String
> -> Test.Framework.Test > -> T.TestTree
> toFTest parser pp d str = testCase str $ do > toFTest parser pp d str = H.testCase str $ do
> let egot = parser d "" Nothing str > let egot = parser d "" Nothing str
> case egot of > case egot of
> Left e -> return () > Left e -> return ()

View file

@ -1,8 +1,8 @@
> import Test.Framework > import Test.Tasty
> import Language.SQL.SimpleSQL.Tests > import Language.SQL.SimpleSQL.Tests
> main :: IO () > main :: IO ()
> main = defaultMain [tests] > main = defaultMain tests