on master help sign in
Test the tags are produced
commitdd27fab5254022e7dc47541e99ebbc314a70b24f authorgmorpheme <github@gmorpheme.net> dateMon 9 Jul 2018, 21:32 (8 years ago) parente5d2f3e
1 file changed+18
test/Data/YamlSpec.hs+18
test/Data/YamlSpec.hs+18
@@ -63,6 +63,8 @@ spec = do
6363 it "count scalars with anchor" caseCountScalarsWithAnchor
6464 it "count sequences with anchor" caseCountSequencesWithAnchor
6565 it "count mappings with anchor" caseCountMappingsWithAnchor
66+ it "count sequences with custom tag" caseCountSequenceTags
67+ it "count mappings with custom tag" caseCountMappingTags
6668 it "count aliases" caseCountAliases
6769 it "count scalars" caseCountScalars
6870 it "largest string" caseLargestString
@@ -249,6 +251,22 @@ caseCountAliases =
249251 isAlias Y.EventAlias{} = True
250252 isAlias _ = False
251253
254+caseCountMappingTags :: Assertion
255+caseCountMappingTags =
256+ caseHelper yamlString isCustomTaggedMapping 1
257+ where
258+ yamlString = "foo: !bar\n k: v\n k2: v2"
259+ isCustomTaggedMapping (Y.EventMappingStart (Y.UriTag "!bar") _) = True
260+ isCustomTaggedMapping _ = False
261+
262+caseCountSequenceTags :: Assertion
263+caseCountSequenceTags =
264+ caseHelper yamlString isCustomTaggedSequence 1
265+ where
266+ yamlString = "foo: !bar [x, y, z]"
267+ isCustomTaggedSequence (Y.EventSequenceStart (Y.UriTag "!bar") _) = True
268+ isCustomTaggedSequence _ = False
269+
252270caseCountScalars :: Assertion
253271caseCountScalars = do
254272 res <- runConduitRes $ Y.decode yamlBS .| CL.fold adder accum