Permalink
Browse files

Update JSON-Schema-Test-Suite

  • Loading branch information...
timjb committed Oct 10, 2012
1 parent 1c129d3 commit 4092c3916c2db50df5b0762c10b5ecf525062477
Showing with 12 additions and 24 deletions.
  1. +1 −17 test/Data/Aeson/Schema/Examples.hs
  2. +10 −6 test/TestSuite.hs
  3. +1 −1 test/test-suite
@@ -16,19 +16,7 @@ examples :: (String -> IO () -> a)
-> (Graph Schema Text -> Schema Text -> Value -> IO ())
-> [a]
examples testCase assertValid' assertInvalid' =
- [ testCase "divisibleBy" $ do
- let by2 = [schemaQQ| { "type": "number", "divisibleBy": 2 } |]
- assertValid by2 [aesonLitQQ| 2 |]
- assertValid by2 [aesonLitQQ| 4 |]
- assertValid by2 [aesonLitQQ| 0 |]
- assertInvalid by2 [aesonLitQQ| 1 |]
- assertInvalid by2 [aesonLitQQ| 3 |]
- let byOneAndHalf = [schemaQQ| { "type": "number", "divisibleBy": 1.5 }]
- assertValid byOneAndHalf [aesonLitQQ| 1.5 |]
- assertValid byOneAndHalf [aesonLitQQ| 3 |]
- assertValid byOneAndHalf [aesonLitQQ| 4.5 |]
- assertInvalid byOneAndHalf [aesonLitQQ| 2.5 |]
- , testCase "patternProperties" $ do
+ [ testCase "patternProperties" $ do
let schema = [schemaQQ| {
"type": "object",
"properties": {
@@ -104,10 +92,6 @@ examples testCase assertValid' assertInvalid' =
assertValid everythingExceptNumbers [aesonLitQQ| { "eins": 1, "zwei": 2 } |]
assertValid everythingExceptNumbers [aesonLitQQ| ["eins", "zwei"] |]
assertValid everythingExceptNumbers [aesonLitQQ| null |]
- , testCase "format: \"regex\"" $ do
- let isRegex = [schemaQQ| { "type": "string", "format": "regex" } |]
- assertValid isRegex "([abc])+\\s+$"
- assertInvalid isRegex "^(abc]"
, testCase "type: subschema" $ do
let schema = [schemaQQ| {
"type": [
View
@@ -8,9 +8,13 @@ import qualified Data.Aeson.Schema.Validator.Tests
import TestSuite.Types (readSchemaTests)
main :: IO ()
-main = readSchemaTests "test/test-suite/tests/draft3" >>= \schemaTests -> defaultMain
- [ testGroup "Data.Aeson.Schema.Types" Data.Aeson.Schema.Types.Tests.tests
- , testGroup "Data.Aeson.Schema.Validator" $ Data.Aeson.Schema.Validator.Tests.tests schemaTests
- , buildTest $ testGroup "Data.Aeson.Schema.CodeGen" <$> Data.Aeson.Schema.CodeGen.Tests.tests schemaTests
- , testGroup "Data.Aeson.Schema.Choice" Data.Aeson.Schema.Choice.Tests.tests
- ]
+main = do
+ requiredTests <- readSchemaTests "test/test-suite/tests/draft3"
+ optionalTests <- readSchemaTests "test/test-suite/tests/draft3/optional"
+ let schemaTests = requiredTests ++ optionalTests
+ defaultMain
+ [ testGroup "Data.Aeson.Schema.Types" Data.Aeson.Schema.Types.Tests.tests
+ , testGroup "Data.Aeson.Schema.Validator" $ Data.Aeson.Schema.Validator.Tests.tests schemaTests
+ , buildTest $ testGroup "Data.Aeson.Schema.CodeGen" <$> Data.Aeson.Schema.CodeGen.Tests.tests schemaTests
+ , testGroup "Data.Aeson.Schema.Choice" Data.Aeson.Schema.Choice.Tests.tests
+ ]

0 comments on commit 4092c39

Please sign in to comment.