Skip to content

Commit c47cd9d

Browse files
committed
updates tests
1 parent 508f480 commit c47cd9d

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

test/Test/Main.purs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Test.Main where
33
import Prelude
44

55
import Control.Monad.Gen as Gen
6-
import Data.Argonaut.Core (Json, foldJson, foldJsonArray, foldJsonBoolean, foldJsonNull, foldJsonNumber, foldJsonObject, foldJsonString, fromArray, fromBoolean, fromNumber, fromObject, fromString, isArray, isBoolean, isNull, isNumber, isObject, isString, jsonNull, stringify, toArray, toBoolean, toNull, toNumber, toObject, toString)
6+
import Data.Argonaut.Core (Json, caseJson, caseJsonArray, caseJsonBoolean, caseJsonNull, caseJsonNumber, caseJsonObject, caseJsonString, fromArray, fromBoolean, fromNumber, fromObject, fromString, isArray, isBoolean, isNull, isNumber, isObject, isString, jsonNull, stringify, toArray, toBoolean, toNull, toNumber, toObject, toString)
77
import Data.Argonaut.Gen (genJson)
88
import Data.Argonaut.Parser (jsonParser)
99
import Data.Array as A
@@ -35,15 +35,15 @@ isTest = do
3535

3636
foldTest :: Effect Unit
3737
foldTest = do
38-
assert (foldFn thisIsNull == "null" <?> "Error in foldJson null")
39-
assert (foldFn thisIsBoolean == "boolean" <?> "Error in foldJson boolean")
40-
assert (foldFn thisIsNumber == "number" <?> "Error in foldJson number")
41-
assert (foldFn thisIsString == "string" <?> "Error in foldJson string")
42-
assert (foldFn thisIsArray == "array" <?> "Error in foldJson array")
43-
assert (foldFn thisIsObject == "object" <?> "Error in foldJson object")
38+
assert (foldFn thisIsNull == "null" <?> "Error in caseJson null")
39+
assert (foldFn thisIsBoolean == "boolean" <?> "Error in caseJson boolean")
40+
assert (foldFn thisIsNumber == "number" <?> "Error in caseJson number")
41+
assert (foldFn thisIsString == "string" <?> "Error in caseJson string")
42+
assert (foldFn thisIsArray == "array" <?> "Error in caseJson array")
43+
assert (foldFn thisIsObject == "object" <?> "Error in caseJson object")
4444

4545
foldFn :: Json -> String
46-
foldFn = foldJson
46+
foldFn = caseJson
4747
(const "null")
4848
(const "boolean")
4949
(const "number")
@@ -63,43 +63,43 @@ cases =
6363

6464
foldXXX :: Effect Unit
6565
foldXXX = do
66-
assert ((foldJsonNull "not null" (const "null") <$> cases) ==
66+
assert ((caseJsonNull "not null" (const "null") <$> cases) ==
6767
["null", "not null", "not null", "not null", "not null", "not null"] <?>
68-
"Error in foldJsonNull")
69-
assert ((foldJsonBoolean "not boolean" (const "boolean") <$> cases) ==
68+
"Error in caseJsonNull")
69+
assert ((caseJsonBoolean "not boolean" (const "boolean") <$> cases) ==
7070
["not boolean", "boolean", "not boolean", "not boolean", "not boolean", "not boolean"] <?>
71-
"Error in foldJsonBoolean")
72-
assert ((foldJsonNumber "not number" (const "number") <$> cases) ==
71+
"Error in caseJsonBoolean")
72+
assert ((caseJsonNumber "not number" (const "number") <$> cases) ==
7373
["not number", "not number", "number", "not number", "not number", "not number"] <?>
74-
"Error in foldJsonNumber")
74+
"Error in caseJsonNumber")
7575

76-
assert ((foldJsonString "not string" (const "string") <$> cases) ==
76+
assert ((caseJsonString "not string" (const "string") <$> cases) ==
7777
["not string", "not string", "not string", "string", "not string", "not string"] <?>
78-
"Error in foldJsonString")
78+
"Error in caseJsonString")
7979

80-
assert ((foldJsonArray "not array" (const "array") <$> cases) ==
80+
assert ((caseJsonArray "not array" (const "array") <$> cases) ==
8181
["not array", "not array", "not array", "not array", "array", "not array"] <?>
82-
"Error in foldJsonArray")
83-
assert ((foldJsonObject "not object" (const "object") <$> cases) ==
82+
"Error in caseJsonArray")
83+
assert ((caseJsonObject "not object" (const "object") <$> cases) ==
8484
["not object", "not object", "not object", "not object", "not object", "object"] <?>
85-
"Error in foldJsonObject")
85+
"Error in caseJsonObject")
8686

8787

8888
fromTest :: Effect Unit
8989
fromTest = do
90-
assert ((foldJsonNull false (const true) jsonNull) <?> "Error in fromNull")
91-
quickCheck (\bool -> foldJsonBoolean Nothing Just (fromBoolean bool) == Just bool <?> "Error in fromBoolean")
92-
quickCheck (\num -> foldJsonNumber Nothing Just (fromNumber num) == Just num <?> "Error in fromNumber")
93-
quickCheck (\str -> foldJsonString Nothing Just (fromString str) == Just str <?> "Error in fromString")
90+
assert ((caseJsonNull false (const true) jsonNull) <?> "Error in fromNull")
91+
quickCheck (\bool -> caseJsonBoolean Nothing Just (fromBoolean bool) == Just bool <?> "Error in fromBoolean")
92+
quickCheck (\num -> caseJsonNumber Nothing Just (fromNumber num) == Just num <?> "Error in fromNumber")
93+
quickCheck (\str -> caseJsonString Nothing Just (fromString str) == Just str <?> "Error in fromString")
9494
quickCheck (\num ->
9595
let arr :: Array Json
9696
arr = A.singleton (fromNumber num)
97-
in (foldJsonArray Nothing Just (fromArray arr) == Just arr)
97+
in (caseJsonArray Nothing Just (fromArray arr) == Just arr)
9898
<?> "Error in fromArray")
9999
quickCheck (\(Tuple str num) ->
100100
let sm :: Obj.Object Json
101101
sm = Obj.singleton str (fromNumber num)
102-
in (foldJsonObject Nothing Just (fromObject sm) == Just sm)
102+
in (caseJsonObject Nothing Just (fromObject sm) == Just sm)
103103
<?> "Error in fromObject")
104104

105105
toTest :: Effect Unit
@@ -136,9 +136,9 @@ main :: Effect Unit
136136
main = do
137137
log "isXxx tests"
138138
isTest
139-
log "foldJson tests"
139+
log "caseJson tests"
140140
foldTest
141-
log "foldJsonXxx tests"
141+
log "caseJsonXxx tests"
142142
foldXXX
143143
log "fromXxx tests"
144144
fromTest

0 commit comments

Comments
 (0)