summaryrefslogtreecommitdiff
path: root/crashboxd/src/test/scala/io/crashbox/ci/yaml/SimpleReadersSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'crashboxd/src/test/scala/io/crashbox/ci/yaml/SimpleReadersSpec.scala')
-rw-r--r--crashboxd/src/test/scala/io/crashbox/ci/yaml/SimpleReadersSpec.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/crashboxd/src/test/scala/io/crashbox/ci/yaml/SimpleReadersSpec.scala b/crashboxd/src/test/scala/io/crashbox/ci/yaml/SimpleReadersSpec.scala
new file mode 100644
index 0000000..198e921
--- /dev/null
+++ b/crashboxd/src/test/scala/io/crashbox/ci/yaml/SimpleReadersSpec.scala
@@ -0,0 +1,23 @@
+package io.crashbox.ci
+package yaml
+
+import org.scalatest._
+
+class SimpleReadersSpec extends FlatSpec with Matchers with SimpleReaders {
+
+ "SimpleReaders" should "convert yaml" in {
+ assert(Yaml.parse("hello").convertTo[String] == "hello")
+ assert(Yaml.parse("42").convertTo[Byte] == 42.toByte)
+ assert(Yaml.parse("42").convertTo[Short] == 42.toShort)
+ assert(Yaml.parse("42").convertTo[Int] == 42)
+ assert(Yaml.parse("42").convertTo[Long] == 42l)
+ assert(Yaml.parse("42.0").convertTo[Float] == 42f)
+ assert(Yaml.parse("42.0").convertTo[Double] == 42.0)
+ assert(Yaml.parse("true").convertTo[Boolean] == true)
+ assert(Yaml.parse("false").convertTo[Boolean] == false)
+ }
+
+ "SimpleReaders" should "fail to convert invalid yaml" in {
+ intercept[YamlFormatException](Yaml.parse("foo").convertTo[Boolean])
+ }
+}