mirror of https://github.com/sbt/sbt.git
Update to latest revision of sjsonnew
This commit is contained in:
parent
cee43575ce
commit
8956da53a8
|
|
@ -6,13 +6,13 @@ import sbt.io.syntax._
|
||||||
import CacheImplicits._
|
import CacheImplicits._
|
||||||
|
|
||||||
import sjsonnew.IsoString
|
import sjsonnew.IsoString
|
||||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, FixedParser }
|
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, Parser }
|
||||||
|
|
||||||
import scala.json.ast.unsafe.JValue
|
import scala.json.ast.unsafe.JValue
|
||||||
|
|
||||||
class CacheSpec extends UnitSpec {
|
class CacheSpec extends UnitSpec {
|
||||||
|
|
||||||
implicit val isoString: IsoString[JValue] = IsoString.iso(CompactPrinter.apply, FixedParser.parseUnsafe)
|
implicit val isoString: IsoString[JValue] = IsoString.iso(CompactPrinter.apply, Parser.parseUnsafe)
|
||||||
|
|
||||||
"A cache" should "NOT throw an exception if read without being written previously" in {
|
"A cache" should "NOT throw an exception if read without being written previously" in {
|
||||||
testCache[String, Int] {
|
testCache[String, Int] {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import sbt.io.syntax._
|
||||||
import CacheImplicits._
|
import CacheImplicits._
|
||||||
|
|
||||||
import sjsonnew.{ Builder, deserializationError, IsoString, JsonFormat, Unbuilder }
|
import sjsonnew.{ Builder, deserializationError, IsoString, JsonFormat, Unbuilder }
|
||||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, FixedParser }
|
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, Parser }
|
||||||
|
|
||||||
import scala.json.ast.unsafe.JValue
|
import scala.json.ast.unsafe.JValue
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ class SingletonCacheSpec extends UnitSpec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
implicit val isoString: IsoString[JValue] = IsoString.iso(CompactPrinter.apply, FixedParser.parseUnsafe)
|
implicit val isoString: IsoString[JValue] = IsoString.iso(CompactPrinter.apply, Parser.parseUnsafe)
|
||||||
|
|
||||||
"A singleton cache" should "throw an exception if read without being written previously" in {
|
"A singleton cache" should "throw an exception if read without being written previously" in {
|
||||||
testCache[Int] {
|
testCache[Int] {
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package sjsonnew
|
|
||||||
package support.scalajson.unsafe
|
|
||||||
|
|
||||||
import scala.json.ast.unsafe._
|
|
||||||
import scala.collection.mutable
|
|
||||||
import jawn.{ SupportParser, MutableFacade }
|
|
||||||
|
|
||||||
object FixedParser extends SupportParser[JValue] {
|
|
||||||
implicit val facade: MutableFacade[JValue] =
|
|
||||||
new MutableFacade[JValue] {
|
|
||||||
def jnull() = JNull
|
|
||||||
def jfalse() = JTrue
|
|
||||||
def jtrue() = JFalse
|
|
||||||
def jnum(s: String) = JNumber(s)
|
|
||||||
def jint(s: String) = JNumber(s)
|
|
||||||
def jstring(s: String) = JString(s)
|
|
||||||
def jarray(vs: mutable.ArrayBuffer[JValue]) = JArray(vs.toArray)
|
|
||||||
def jobject(vs: mutable.Map[String, JValue]) = {
|
|
||||||
val array = new Array[JField](vs.size)
|
|
||||||
var i = 0
|
|
||||||
vs.foreach {
|
|
||||||
case (key, value) =>
|
|
||||||
array(i) = JField(key, value)
|
|
||||||
i += 1
|
|
||||||
}
|
|
||||||
JObject(array)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,13 +6,13 @@ import sbt.io.syntax._
|
||||||
import CacheImplicits._
|
import CacheImplicits._
|
||||||
|
|
||||||
import sjsonnew.IsoString
|
import sjsonnew.IsoString
|
||||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, FixedParser }
|
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter, Parser }
|
||||||
|
|
||||||
import scala.json.ast.unsafe.JValue
|
import scala.json.ast.unsafe.JValue
|
||||||
|
|
||||||
class TrackedSpec extends UnitSpec {
|
class TrackedSpec extends UnitSpec {
|
||||||
|
|
||||||
implicit val isoString: IsoString[JValue] = IsoString.iso(CompactPrinter.apply, FixedParser.parseUnsafe)
|
implicit val isoString: IsoString[JValue] = IsoString.iso(CompactPrinter.apply, Parser.parseUnsafe)
|
||||||
|
|
||||||
"lastOutput" should "store the last output" in {
|
"lastOutput" should "store the last output" in {
|
||||||
withStore { store =>
|
withStore { store =>
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package sjsonnew
|
|
||||||
package support.scalajson.unsafe
|
|
||||||
|
|
||||||
import scala.json.ast.unsafe._
|
|
||||||
import scala.collection.mutable
|
|
||||||
import jawn.{ SupportParser, MutableFacade }
|
|
||||||
|
|
||||||
object FixedParser extends SupportParser[JValue] {
|
|
||||||
implicit val facade: MutableFacade[JValue] =
|
|
||||||
new MutableFacade[JValue] {
|
|
||||||
def jnull() = JNull
|
|
||||||
def jfalse() = JTrue
|
|
||||||
def jtrue() = JFalse
|
|
||||||
def jnum(s: String) = JNumber(s)
|
|
||||||
def jint(s: String) = JNumber(s)
|
|
||||||
def jstring(s: String) = JString(s)
|
|
||||||
def jarray(vs: mutable.ArrayBuffer[JValue]) = JArray(vs.toArray)
|
|
||||||
def jobject(vs: mutable.Map[String, JValue]) = {
|
|
||||||
val array = new Array[JField](vs.size)
|
|
||||||
var i = 0
|
|
||||||
vs.foreach {
|
|
||||||
case (key, value) =>
|
|
||||||
array(i) = JField(key, value)
|
|
||||||
i += 1
|
|
||||||
}
|
|
||||||
JObject(array)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -26,7 +26,7 @@ object Dependencies {
|
||||||
|
|
||||||
lazy val parserCombinator211 = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
|
lazy val parserCombinator211 = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
|
||||||
|
|
||||||
lazy val sjsonnewVersion = "0.4.1"
|
lazy val sjsonnewVersion = "0.4.2"
|
||||||
lazy val sjsonnew = "com.eed3si9n" %% "sjson-new-core" % sjsonnewVersion
|
lazy val sjsonnew = "com.eed3si9n" %% "sjson-new-core" % sjsonnewVersion
|
||||||
lazy val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion
|
lazy val sjsonnewScalaJson = "com.eed3si9n" %% "sjson-new-scalajson" % sjsonnewVersion
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue