summaryrefslogtreecommitdiff
path: root/crashboxd/src/test/scala/io/crashbox/ci/yaml/CompositeReadersSpec.scala
blob: 02a13ca243a2d8a701374acc7976d21296bb990c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)))
  }

}