Skip to content

Commit 16c0ea3

Browse files
committed
Tidy up
1 parent 470b13d commit 16c0ea3

File tree

7 files changed

+9
-106
lines changed

7 files changed

+9
-106
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ cabal.sandbox.config
1919
/.stack-work/
2020
/result
2121
/deps
22-
/*.json
23-
/*.json.ib
24-
/*.json.bp
22+
/*.xml
23+
/*.xml.ib
24+
/*.xml.bp
2525
/snapshot.yaml
2626
/stack-ci.yaml

hw-xml.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ category: Data, XML
1212
build-type: Simple
1313
extra-source-files: README.md
1414
cabal-version: >= 1.22
15-
data-files: test/data/sample.xml
15+
data-files: data/catalog.xml
1616

1717
executable hw-xml-example
1818
hs-source-dirs: app

test/HaskellWorks/Data/Xml/Conduit/BlankSpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import qualified Data.ByteString as BS
1818

1919
whenBlankedXmlShouldBe :: BS.ByteString -> BS.ByteString -> Spec
2020
whenBlankedXmlShouldBe original expected = do
21-
it (show original <> " when blanked json should be " <> show expected) $ do
21+
it (show original <> " when blanked xml should be " <> show expected) $ do
2222
BS.concat (runListConduit blankXml [original]) `shouldBe` expected
2323

2424
repeatBS :: Int -> BS.ByteString -> BS.ByteString

test/HaskellWorks/Data/Xml/RawValueSpec.hs

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ genSpec :: forall t u.
7474
)
7575
=> String -> XmlCursor BS.ByteString t u -> SpecWith ()
7676
genSpec 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

test/HaskellWorks/Data/Xml/Succinct/CursorSpec.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ genSpec t _ = do
117117
xit "depth at first child of object at second child of array" $ do
118118
(fc >=> ns >=> fc >=> ns >=> cd) cursor `shouldBe` Just 3
119119

120-
describe "For sample Json" $ do
120+
describe "For sample XML" $ do
121121
let cursor = "<widget debug=\"on\"> \
122122
\ <window name=\"main_window\"> \
123123
\ <dimension>500</dimension> \

test/HaskellWorks/Data/Xml/TypeSpec.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fc = TC.firstChild
4040
ns = TC.nextSibling
4141

4242
spec :: Spec
43-
spec = describe "HaskellWorks.Data.Json.Succinct.CursorSpec" $ do
43+
spec = describe "HaskellWorks.Data.Xml.TypeSpec" $ do
4444
describe "Cursor for [Bool]" $ do
4545
it "initialises to beginning of empty object" $ do
4646
let cursor = "<elem />" :: XmlCursor String (BitShown [Bool]) (SimpleBalancedParens [Bool])
@@ -91,7 +91,7 @@ genSpec :: forall t u.
9191
)
9292
=> String -> (XmlCursor BS.ByteString t u) -> SpecWith ()
9393
genSpec t _ = do
94-
describe ("Json cursor of type " ++ t) $ do
94+
describe ("XML cursor of type " ++ t) $ do
9595
let forXml (cursor :: XmlCursor BS.ByteString t u) f = describe ("of value " ++ show cursor) (f cursor)
9696
forXml "<elem/>" $ \cursor -> do
9797
it "should have correct type" $ xmlTypeAt cursor `shouldBe` Just XmlTypeElement

test/data/sample.xml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)