News for hackers. Stuff that matters.
Re:Scala – The good, the bad and the very ugly by yummyfajitas on Tuesday October 07, 2014 @11:22AM (#8421633)
Here is some actual test code, based on scalacheck:

  property("to and from file") = forAllNoShrink(genArrayForSeries)( data => {
    withTempDir(f => {
      val (stagingDir, dataDir) = mkdirs(f)
      val s = SequentialBinaryV1Storage(dataDir, stagingDir)
      val id = SeriesIdent(UUID.randomUUID().toString)
      val oldSeries = BufferedSeries(id, data._1, data._2)
      s.write(oldSeries)
      val newSeries = s.read(id).get
      ((oldSeries.ident == newSeries.ident) :| "identities do not match") &&
      ((oldSeries.data == newSeries.data) :| "data series do not match")
    })
  })
Not much DSL, though there are a few helper functions handling stuff like creating a tempdir for the test and deleting when finished.

There are no comments on this comment yet.