Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Clean up new testsuite #114

Merged
merged 35 commits into from

4 participants

@imalsogreg
  • Combined each Snaplet's testing App into one
  • Reintroduced Blackbox tests
  • Moved several files from non-cabal-appdir to the root of the repository (todo - move all test resources into the test directory in a way that works with Snap.Snaplet.Test)
  • Uncomment the readRequestBody failure test - test suite will fail until we fix bug
  • Tidied up snap.cabal extra-source-files, tested with cabal sdist and rebuilding from the snap-1.0.0.0.tar.gz to make sure all files are getting packaged up
runTestsAndCoverage.sh
((5 lines not shown))
Snap.Snaplet.Auth.Handlers.Tests
Snap.Snaplet.Auth.Tests
-Snap.Snaplet.Heist.App
+Snap.Snaplet.Common.App
+Snap.Snaplet.Common.BarSnaplet
+Snap.Snaplet.Common.EmbeddedSnaplet
+Snap.Snaplet.Common.FooSnaplet
+Snap.Snaplet.Common.Handlers
+Snap.Snaplet.Common.Types
@gregorycollins Owner

Can we rename these modules to make it clear that they belong to the testsuite? (I.e. Snap.Snaplet.Test.Common.*)

For sure. I can probably get to this in about an hour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gregorycollins gregorycollins commented on the diff
src/Snap/Snaplet/Config.hs
@@ -36,7 +36,7 @@ newtype AppConfig = AppConfig { appEnvironment :: Maybe String }
-- dynamic loader package can be updated so that manual Typeable instances
-- are no longer needed.
appConfigTyCon :: TyCon
-appConfigTyCon = mkTyCon3 "snap" "Snap.Snaplet.Config" "AppConfig"
+appConfigTyCon = mkTyCon "Snap.Snaplet.Config.AppConfig"
@gregorycollins Owner

Isn't this a regression? The mkTyCon function has been deprecated in favor of mkTyCon3 (or just deriving Typeable).

@mightybyte Owner

We talked with @chowells79 about this. I'm not remembering the details right now...

@chowells79 Collaborator

mkTyCon3 was kind of a false start. The only versions of GHC that actually don't allow you to use mkTyCon also don't allow you to create Typeable instances by hand. As such, compilation on GHC 7.8+ should never involve any form of mkTyCon, and before that, just go with what works.

I use mkTyCon here only in the base < 4.7 case to match most of the recent history in this file (it was only briefly changed to mkTyCon3 to fix an import error). snap-loader-dynamic wants typeOf to return a full "Snap.Snaplet.AppConfig" when base < 4.7, which isn't what happens when mkTyCon3 is used I bevieve (<- and just verified).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
test/suite/Snap/Snaplet/Common/Handlers.hs
((4 lines not shown))
+import Control.Monad.IO.Class (liftIO)
+import Data.Configurator (lookup)
+import Data.Maybe (fromJust, fromMaybe)
+import Data.Text (append, pack)
+import Data.Text.Encoding (decodeUtf8)
+------------------------------------------------------------------------------
+import Data.Map.Syntax ((##))
+import Heist.Interpreted (textSplice)
+import Snap.Core (writeText, getParam)
+--import Snap.Http.Server.Config (Config, completeConfig,
+-- defaultConfig)
+import Snap.Snaplet (Handler,
+ getSnapletUserConfig,
+ nestSnaplet,
+ with)
+--import Snap.Snaplet.Auth (AuthManager,
@gregorycollins Owner

Please clean up this cruft before we merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gregorycollins gregorycollins commented on the diff
test/suite/TestSuite.hs
((10 lines not shown))
Blackbox.Tests.remove
- "non-cabal-appdir/snaplets/heist/templates/good.tpl"
- Blackbox.Tests.removeDir "non-cabal-appdir/snaplets/foosnaplet"
+ "snaplets/heist/templates/good.tpl"
+ {- Why were we removing this?
+ Blackbox.Tests.removeDir "snaplets/foosnaplet"
@gregorycollins Owner

Good question :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gregorycollins

Thanks for doing all this cleanup work!

@gregorycollins

Sorry for taking so long to review+merge this, I've been moving between countries.

runTestsAndCoverage.sh
@@ -2,6 +2,8 @@
set -e
+cp -r test/snaplets ./
@gregorycollins Owner

I don't love this, can you fix it to not litter files in the root directory?

There's the complementary clean-up line on line 71, deleting that directory after testing

https://github.com/imalsogreg/snap/blob/master/runTestsAndCoverage.sh#L71

I tried a bit to get the test snaplet to look in a directory other than project's root for the snaplet directory, but didn't manage to make it work. Keep trying?

@mightybyte Owner

Can you do a "cd test" so that everything moves into the test directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
snap.cabal
@@ -179,9 +169,11 @@ Library
if impl(ghc >= 6.12.0)
ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
-fno-warn-orphans -fno-warn-unused-do-bind
+ -fhpc
@gregorycollins Owner

You can't put -fhpc on the library definition, it'll insert profiling code for all users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@gregorycollins gregorycollins commented on the diff
snap.cabal
@@ -279,7 +285,6 @@ Test-suite testsuite
time >= 1.1 && < 1.5,
transformers >= 0.2 && < 0.5,
transformers-base >= 0.4 && < 0.5,
--- unix >= 2.6.0.1 && < 2.7,
@gregorycollins Owner

If we don't need this library then just delete the line?

Yep, that line is gone (github's '-' in the diff seems to be combining with the '--' of the commented line in a confusing way).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@imalsogreg

@gregorycollins No worries about the slow merge. There are a lot of changes to check (and I see that this now has merge conflicts for some reason). Thanks for patience w/ some of my oversights (like -fhpc flag in the library). That's now fixed. Feedback's been great, feel free to keep letting me know if you need more changes before you pull it in.

@mightybyte
Owner

Yeah, this package is currently in a bit of flux because of my changes to heist. Can you try merging master into your branch? If any conflicts come up that you don't understand, let me know and I'll help with them.

@mightybyte mightybyte merged commit 1e8b177 into snapframework:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 28, 2014
  1. @imalsogreg
Commits on Jun 29, 2014
  1. @imalsogreg
  2. @imalsogreg
  3. @imalsogreg

    Bring in Blackbox tests (having trouble getting them to pass), and us…

    imalsogreg authored
    …e Common.App in place of Config.App
  4. @imalsogreg

    Reintroduce Blackbox tests

    imalsogreg authored
  5. @imalsogreg

    Add forgotten db.cfg file

    imalsogreg authored
  6. @imalsogreg
Commits on Jun 30, 2014
  1. @imalsogreg
  2. @imalsogreg

    remove custom Test.App

    imalsogreg authored
  3. @imalsogreg
  4. @imalsogreg
  5. @imalsogreg
  6. @imalsogreg

    Bring back .ghci file

    imalsogreg authored
  7. @imalsogreg

    whitespace

    imalsogreg authored
Commits on Jul 1, 2014
  1. @imalsogreg
Commits on Jul 3, 2014
  1. @imalsogreg
  2. @imalsogreg
  3. @imalsogreg
  4. @imalsogreg
Commits on Jul 4, 2014
  1. @imalsogreg
Commits on Jul 28, 2014
  1. @imalsogreg
Commits on Aug 11, 2014
  1. @imalsogreg
  2. @imalsogreg

    Cleanup import cruft

    imalsogreg authored
  3. @imalsogreg

    Rename testing modules

    imalsogreg authored
  4. @imalsogreg
Commits on Sep 12, 2014
  1. @imalsogreg
Commits on Sep 19, 2014
  1. @imalsogreg
  2. @imalsogreg
Commits on Sep 20, 2014
  1. @imalsogreg
  2. @imalsogreg
  3. @imalsogreg

    remove copy of good.tpl

    imalsogreg authored
  4. @imalsogreg
  5. @imalsogreg
Commits on Sep 21, 2014
  1. @imalsogreg
Commits on Oct 9, 2014
  1. @imalsogreg
Something went wrong with that request. Please try again.