@@ -74,7 +74,7 @@ genSpec :: forall t u.
7474 )
7575 => String -> XmlCursor BS. ByteString t u -> SpecWith ()
7676genSpec t _ = do
77- describe (" Json cursor of type " <> t) $ do
77+ describe (" XML cursor of type " <> t) $ do
7878 let forXml (cursor :: XmlCursor BS. ByteString t u ) f = describe (" of value " <> show cursor) (f cursor)
7979
8080 forXml " <a/>" $ \ cursor -> do
@@ -122,72 +122,3 @@ genSpec t _ = do
122122 rawValueVia ((ns >=> fc >=> fc) cursor) `shouldBe` RawAttrName " text"
123123 rawValueVia ((ns >=> fc >=> fc >=> ns) cursor) `shouldBe` RawAttrValue " value"
124124 rawValueVia ((ns >=> fc >=> ns) cursor) `shouldBe` RawText " free"
125-
126- -- forXml " {}" $ \cursor -> do
127- -- it "should have correct value" $ rawValueVia (Just cursor) `shouldBe` Right (JsonObject [])
128- -- forXml "1234" $ \cursor -> do
129- -- it "should have correct value" $ rawValueVia (Just cursor) `shouldBe` Right (JsonNumber 1234)
130- -- forXml "\"Hello\"" $ \cursor -> do
131- -- it "should have correct value" $ rawValueVia (Just cursor) `shouldBe` Right (JsonString "Hello")
132- -- forXml "[]" $ \cursor -> do
133- -- it "should have correct value" $ rawValueVia (Just cursor) `shouldBe` Right (JsonArray [])
134- -- forXml "true" $ \cursor -> do
135- -- it "should have correct value" $ rawValueVia (Just cursor) `shouldBe` Right (JsonBool True)
136- -- forXml "false" $ \cursor -> do
137- -- it "should have correct value" $ rawValueVia (Just cursor) `shouldBe` Right (JsonBool False)
138- -- forXml "null" $ \cursor -> do
139- -- it "should have correct value" $ rawValueVia (Just cursor) `shouldBe` Right JsonNull
140- -- forXml "[null]" $ \cursor -> do
141- -- it "should have correct value" $ rawValueVia (Just cursor) `shouldBe` Right (JsonArray [JsonNull])
142- -- it "should have correct value" $ rawValueVia (fc cursor) `shouldBe` Right JsonNull
143- -- it "depth at top" $ cd cursor `shouldBe` Just 1
144- -- it "depth at first child of array" $ (fc >=> cd) cursor `shouldBe` Just 2
145- -- forXml "[null, {\"field\": 1}]" $ \cursor -> do
146- -- it "cursor can navigate to second child of array" $ do
147- -- rawValueVia ((fc >=> ns) cursor) `shouldBe` Right ( JsonObject [("field", JsonNumber 1)] )
148- -- rawValueVia (Just cursor) `shouldBe` Right (JsonArray [JsonNull, JsonObject [("field", JsonNumber 1)]])
149- -- it "depth at second child of array" $ do
150- -- (fc >=> ns >=> cd) cursor `shouldBe` Just 2
151- -- it "depth at first child of object at second child of array" $ do
152- -- (fc >=> ns >=> fc >=> cd) cursor `shouldBe` Just 3
153- -- it "depth at first child of object at second child of array" $ do
154- -- (fc >=> ns >=> fc >=> ns >=> cd) cursor `shouldBe` Just 3
155- -- describe "For empty json array" $ do
156- -- let cursor = "[]" :: XmlCursor BS.ByteString t u
157- -- it "can navigate down and forwards" $ do
158- -- rawValueVia (Just cursor) `shouldBe` Right (JsonArray [])
159- -- describe "For empty json array" $ do
160- -- let cursor = "[null]" :: XmlCursor BS.ByteString t u
161- -- it "can navigate down and forwards" $ do
162- -- rawValueVia (Just cursor) `shouldBe` Right (JsonArray [JsonNull])
163- -- describe "For sample Json" $ do
164- -- let cursor = "{ \
165- -- \ \"widget\": { \
166- -- \ \"debug\": \"on\", \
167- -- \ \"window\": { \
168- -- \ \"name\": \"main_window\", \
169- -- \ \"dimensions\": [500, 600.01e-02, true, false, null] \
170- -- \ } \
171- -- \ } \
172- -- \}" :: XmlCursor BS.ByteString t u
173- -- it "can navigate down and forwards" $ do
174- -- let array = JsonArray [JsonNumber 500, JsonNumber 600.01e-02, JsonBool True, JsonBool False, JsonNull] :: JsonValue
175- -- let object1 = JsonObject ([("name", JsonString "main_window"), ("dimensions", array)]) :: JsonValue
176- -- let object2 = JsonObject ([("debug", JsonString "on"), ("window", object1)]) :: JsonValue
177- -- let object3 = JsonObject ([("widget", object2)]) :: JsonValue
178- -- rawValueVia (Just cursor) `shouldBe` Right object3
179- -- rawValueVia ((fc ) cursor) `shouldBe` Right (JsonString "widget" )
180- -- rawValueVia ((fc >=> ns ) cursor) `shouldBe` Right (object2 )
181- -- rawValueVia ((fc >=> ns >=> fc ) cursor) `shouldBe` Right (JsonString "debug" )
182- -- rawValueVia ((fc >=> ns >=> fc >=> ns ) cursor) `shouldBe` Right (JsonString "on" )
183- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns ) cursor) `shouldBe` Right (JsonString "window" )
184- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns ) cursor) `shouldBe` Right (object1 )
185- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc ) cursor) `shouldBe` Right (JsonString "name" )
186- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns ) cursor) `shouldBe` Right (JsonString "main_window" )
187- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns ) cursor) `shouldBe` Right (JsonString "dimensions" )
188- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns >=> ns ) cursor) `shouldBe` Right (array )
189- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc ) cursor) `shouldBe` Right (JsonNumber 500 )
190- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns ) cursor) `shouldBe` Right (JsonNumber 600.01e-02 )
191- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns ) cursor) `shouldBe` Right (JsonBool True )
192- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns >=> ns ) cursor) `shouldBe` Right (JsonBool False )
193- -- rawValueVia ((fc >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns >=> ns >=> fc >=> ns >=> ns >=> ns >=> ns) cursor) `shouldBe` Right JsonNull
0 commit comments