Skip to content

Commit

Permalink
add simple test re #41
Browse files Browse the repository at this point in the history
  • Loading branch information
carueda committed Dec 22, 2018
1 parent 5f3bfde commit 7702a8c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/main/scala/misc/QuotedUnquoted.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package misc

import com.typesafe.config.ConfigFactory

/*
See https://github.com/carueda/tscfg/issues/41#issuecomment-449521552
sbt> runMain misc.QuotedUnquoted
input line cv.toString cv.valueType
-------------- ---------------- --------------
sizeU: 50G Quoted("50G") STRING
sizeQ: "50G" Quoted("50G") STRING
fooU: foo Unquoted("foo") STRING
fooQ: "foo" Quoted("foo") STRING
*/
object QuotedUnquoted {
def main(args: Array[String]): Unit = {
val inputLines = List(
""" sizeU: 50G """,
""" sizeQ: "50G" """,
""" fooU: foo """,
""" fooQ: "foo" """
)
val config = ConfigFactory.parseString(inputLines.mkString("\n"))

println(" %-14s %16s %14s" format("input line", "cv.toString", "cv.valueType"))
println(" %-14s %16s %14s" format("-"*14, "-"*16, "-"*14))
for ((key, inputLine) List("sizeU", "sizeQ", "fooU", "fooQ") zip inputLines) {
val cv = config.getValue(key)
println(" %-14s %16s %14s" format(inputLine.trim, cv.toString, cv.valueType()))
}
}
}

0 comments on commit 7702a8c

Please sign in to comment.