git.iko.soy/typeable/hjsonschema
on master help sign in
Do our HTTP stuff internally.
commit4694c21b2ccaf3f2a853d279d5769a8cd8e73e16 authorMichael Alan Dorman <mdorman@ironicdesign.com> dateThu 30 Apr 2015, 11:11 (11 years ago) parent601acfa
3 files changed+14−14
README.md−8 hjsonschema.cabal+3 tests/Remote.hs+11−6
README.md−8
@@ -48,14 +48,6 @@ fromList ["Val error against uniqueItems True for: Array (fromList [String \"foo
4848
4949 git submodule update --init
5050
51−# Prepare Tests
52−
53−+ `cd JSON-Schema-Test-Suite/remotes`
54−
55−+ `hserv --port=1234` / `python -m SimpleHTTPServer 1234`
56−
57−Note that the `remote` test suite requires an internet connection.
58−
5951# Notes
6052
6153+ This uses the [regexpr](https://hackage.haskell.org/package/regexpr-0.5.4) regular expression library for the "pattern" validator. I have no idea if this is compatible with the ECMA 262 regex dialect, which the [spec](http://json-schema.org/latest/json-schema-validation.html#anchor33) requires.
hjsonschema.cabal+3
@@ -70,6 +70,7 @@ test-suite remote
7070 default-extensions: OverloadedStrings
7171 other-extensions: TemplateHaskell
7272 build-depends: aeson
73+ , async
7374 , base
7475 , bytestring
7576 , hjsonschema
@@ -81,6 +82,8 @@ test-suite remote
8182 , HUnit >= 1.2 && < 1.3
8283 , test-framework >= 0.8 && < 0.9
8384 , test-framework-hunit >= 0.3 && < 0.4
85+ , wai-app-static
86+ , warp
8487
8588source-repository head
8689 type: git
tests/Remote.hs+11−6
@@ -1,17 +1,22 @@
11module Main where
22
33import Control.Applicative
4−import Data.List (isSuffixOf)
4+import Control.Concurrent.Async (withAsync)
5+import Data.List (isSuffixOf)
56import Lib
6−import System.Directory (getDirectoryContents)
7+import Network.Wai.Application.Static (defaultFileServerSettings,
8+ staticApp)
9+import Network.Wai.Handler.Warp (run)
10+import System.Directory (getDirectoryContents)
711import Test.Framework
812
913main :: IO ()
10−main = do
11− filenames <- filter (not . isLocal) . filter (".json" `isSuffixOf`)
14+main =
15+ withAsync (run 1234 $ staticApp $ defaultFileServerSettings "JSON-Schema-Test-Suite/remotes") $ \_ -> do
16+ filenames <- filter (not . isLocal) . filter (".json" `isSuffixOf`)
1217 <$> getDirectoryContents dir
13− ts <- readSchemaTests dir filenames
14− defaultMain (toTest <$> ts)
18+ ts <- readSchemaTests dir filenames
19+ defaultMain (toTest <$> ts)
1520
1621 where
1722 dir :: String