@@ -62,6 +62,8 @@ main = hspec $ do
6262 it "parses when titlecase" caseTitlecaseBool
6363 describe "empty input" $ do
6464 it "doesn't crash" caseEmptyInput
65+ describe "alias stripping" $ do
66+ it "works" caseStripAlias
6567 describe "nulls" $ do
6668 checkNull "null"
6769 checkNull "Null"
@@ -365,3 +367,19 @@ checkNull x =
365367 it ("null recognized: " ++ show x) assertion
366368 where
367369 assertion = Just (object [("foo", D.Null)]) @=? D.decode (B8.pack $ "foo: " ++ T.unpack x)
370+
371+caseStripAlias :: Assertion
372+caseStripAlias =
373+ D.decode src @?= Just (object
374+ [ "Default" .= object
375+ [ "foo" .= (1 :: Int)
376+ , "bar" .= (2 :: Int)
377+ ]
378+ , "Obj" .= object
379+ [ "foo" .= (1 :: Int)
380+ , "bar" .= (2 :: Int)
381+ , "key" .= (3 :: Int)
382+ ]
383+ ])
384+ where
385+ src = "Default: &def\n foo: 1\n bar: 2\nObj:\n <<: *def\n key: 3\n"