on master help sign in
Test the tags are produced
dd27fabgmorpheme
test/Data/YamlSpec.hs+18
@@ -63,6 +63,8 @@ spec = do
63 it "count scalars with anchor" caseCountScalarsWithAnchor
63 it "count scalars with anchor" caseCountScalarsWithAnchor
64 it "count sequences with anchor" caseCountSequencesWithAnchor
64 it "count sequences with anchor" caseCountSequencesWithAnchor
65 it "count mappings with anchor" caseCountMappingsWithAnchor
65 it "count mappings with anchor" caseCountMappingsWithAnchor
66+ it "count sequences with custom tag" caseCountSequenceTags
67+ it "count mappings with custom tag" caseCountMappingTags
66 it "count aliases" caseCountAliases
68 it "count aliases" caseCountAliases
67 it "count scalars" caseCountScalars
69 it "count scalars" caseCountScalars
68 it "largest string" caseLargestString
70 it "largest string" caseLargestString
@@ -249,6 +251,22 @@ caseCountAliases =
249 isAlias Y.EventAlias{} = True
251 isAlias Y.EventAlias{} = True
250 isAlias _ = False
252 isAlias _ = False
251
253
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+
252caseCountScalars :: Assertion
270caseCountScalars :: Assertion
253caseCountScalars = do
271caseCountScalars = do
254 res <- runConduitRes $ Y.decode yamlBS .| CL.fold adder accum
272 res <- runConduitRes $ Y.decode yamlBS .| CL.fold adder accum