postgresql-syntax-0.5.0.0: hspec-test/Ast/SelectWithParensSpec.hs
module Ast.SelectWithParensSpec (spec) where
import Helpers.Specs
import PostgresqlSyntax.Ast.SelectNoParens
import PostgresqlSyntax.Ast.SelectWithParens
import PostgresqlSyntax.IsAst
import Test.Hspec
import Prelude
spec :: Spec
spec = do
itSatisfiesIsAst @SelectWithParens
itSatisfiesArbitrary @SelectWithParens
describe "Nesting depth" $ do
-- The parenthesised sub-select has two possible representations.
it "redundant parens around a sub-select are canonicalised"
$ parse @SelectWithParens mempty "((select 1))"
`shouldBe` (WithParensSelectWithParens . NoParensSelectWithParens <$> parse @SelectNoParens mempty "select 1")