Skip to content

Remove CPP from test suite, take 2 - #880

Merged
parsonsmatt merged 35 commits into
masterfrom
matt/factor-cpp-out
Apr 10, 2019
Merged

parsonsmatt merged 35 commits into
masterfrom
matt/factor-cpp-out

Conversation

@parsonsmatt

@parsonsmatt parsonsmatt commented Apr 5, 2019 •

Copy link
Copy Markdown
Collaborator

This PR removes all the CPP from the test suite.

I've pinged a few of you on a request; it's a big PR though and I won't be mad if you don't look at all of it. Self-review icoming.

Comment thread .travis.yml
- env: ARGS="--resolver lts-10 --stack-yaml stack_lts-10.yaml"
- env: ARGS="--resolver lts-11"
- env: ARGS="--resolver lts-12"
- env: ARGS="--resolver lts-13"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray for simpler CI!

@Vlix Vlix Apr 10, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for leaving in 6 and 9, but not the other ones between 6 and 11?

(EDIT: n/m I must have looked at a specific commit or something)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're all resolvers for distinct GHC versions. 7.10.3, 8.0.2, 8.2, 8.4, and 8.6 are represented here. More resolvers seemed redundant to me.

, mtl
, containers
, blaze-html
, time

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deps are somewhat sloppy. They could be weedered now that we don't have so much CPP.

{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module EmbedTestMongo (specs) where

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these tests were just really hard to unentangle, and this was one of them. Instead of detangling it I just copied it.

PersistentTest.cleanDB

hspec $ do
RenameTest.specsWith db

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the test suites are now parameterized by a database runner function: type DbRunner backend m = ReaderT bakend m () -> IO (). This,combined with mpsGeneric = True, allows us to have most of these tests be generic over the backend.

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}

module ArrayAggTest where

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests that were enabled for a single backend were factored into the specific test suite.

@@ -0,0 +1,153 @@
{-# LANGUAGE QuasiQuotes, GADTs, OverloadedStrings #-}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test suite is annoying. We can't have a circular dependency, so in order to depend on persistent-sqlite to have a driver to run these tests against, we have to not depend on persistent-test

@@ -1,53 +0,0 @@
{-# LANGUAGE EmptyDataDecls #-}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was incorproated into the other test suite.

@parsonsmatt

Copy link
Copy Markdown
Collaborator Author

I'm gonna merge this on Wednesday if no one has any objections

@Vlix

Vlix commented Apr 9, 2019

Copy link
Copy Markdown
Contributor

Will try to take a look at it tonight.

@Vlix

Vlix commented Apr 9, 2019

Copy link
Copy Markdown
Contributor

Couldn't look in too much detail, and you've moved mountains, so from a somewhat intensive skimming, I'd say: "If it compiles, and tests, should probably be ok?"

@parsonsmatt

Copy link
Copy Markdown
Collaborator Author

Yeah, the only thing that's really changed is that the MongoDB tests have totally different behavior on upsert. I'm tempted to call that a bug in the MongoDB library, but it may just be that they need to have totally different specifications factored out.

@Vlix Vlix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions that popped up after taking a last glance at the entire diff.

{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE EmptyDataDecls #-}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the feeling most of these pragmas in lots of files are completely superfluous, no?
I'll make a PR and go through pragmas and dependencies after this is merged to clean up, I think.

Comment thread .travis.yml
- env: ARGS="--resolver lts-10 --stack-yaml stack_lts-10.yaml"
- env: ARGS="--resolver lts-11"
- env: ARGS="--resolver lts-12"
- env: ARGS="--resolver lts-13"

@Vlix Vlix Apr 10, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for leaving in 6 and 9, but not the other ones between 6 and 11?

(EDIT: n/m I must have looked at a specific commit or something)

@parsonsmatt
parsonsmatt merged commit c0ff204 into master Apr 10, 2019
@parsonsmatt
parsonsmatt deleted the matt/factor-cpp-out branch February 14, 2020 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants