forked from slamdata/purescript-sql-squared
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGen.purs
More file actions
24 lines (18 loc) · 698 Bytes
/
Copy pathGen.purs
File metadata and controls
24 lines (18 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module Test.Gen where
import Prelude
import Control.Monad.Gen as Gen
import Data.Either as E
import Effect (Effect)
import SqlSquared (SqlQuery, genSqlQuery, printQuery)
import SqlSquared.Parser as Parser
import Test.QuickCheck as QC
import Test.QuickCheck.Arbitrary as A
newtype ArbSql = ArbSql SqlQuery
instance arbitraryArbSql ∷ A.Arbitrary ArbSql where
arbitrary = map ArbSql $ Gen.resize (const 3) genSqlQuery
newtype ParseableSql = ParseableSql SqlQuery
test ∷ Effect Unit
test =
QC.quickCheck' 1000 \(ArbSql sql) → case Parser.tokenize $ printQuery sql of
E.Left err → QC.Failed $ "Tokenizer error: " <> show err <> " \n" <> printQuery sql
E.Right _ → QC.Success