summaryrefslogblamecommitdiff
path: root/crashboxd/src/test/scala/io/crashbox/ci/yaml/CompositeReadersSpec.scala
blob: 02a13ca243a2d8a701374acc7976d21296bb990c (plain) (tree)

























                                                                          
package io.crashbox.ci
package yaml

import org.scalatest._

class CompositeReadersSpec
    extends FlatSpec
    with Matchers
    with CompositeReaders
    with SimpleReaders {

  "CompositeReaders" should "convert yaml" in {
    assert(
      Yaml.parse("hello: world").convertTo[Map[String, String]] == Map(
        "hello" -> "world"))
    assert(
      Yaml.parse("hello: 42").convertTo[Map[String, Int]] == Map(
        "hello" -> 42))

    assert(Yaml.parse("- 42").convertTo[Seq[Int]] == Seq(42))
    assert(
      Yaml.parse("hello:\n - 42").convertTo[Map[String, Seq[Int]]] == Map(
        "hello" -> Seq(42)))
  }

}