Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[split] scrooge: use scalatest, remove specs
RB_ID=263371
- Loading branch information
David Helder
authored and
CI
committed
Jan 9, 2014
1 parent
03ca491
commit 08a5d46
Showing
27 changed files
with
1,711 additions
and
1,394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 8 additions & 4 deletions
12
demos/scrooge-maven-demo/src/test/scala/com/twitter/example/DemoSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 28 additions & 28 deletions
56
scrooge-generator/src/test/scala/com/twitter/scrooge/ThriftStructMetaDataSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
package com.twitter.scrooge | ||
|
||
import com.twitter.scrooge.testutil.Spec | ||
import org.apache.thrift.protocol.TType | ||
import org.specs.SpecificationWithJUnit | ||
import scala.collection.{Map, Set} | ||
import thrift.test._ | ||
|
||
// This is a cross project test and I feel bad for putting it here | ||
// but scrooge-generator already has all the infrastructure to do | ||
// generation and testing and anyway requires scrooge-runtime for | ||
// tests. | ||
class ThriftStructMetaDataSpec extends SpecificationWithJUnit { | ||
class ThriftStructMetaDataSpec extends Spec { | ||
"Provide useful metadata" in { | ||
val s = XtructColl(Map(1 -> 2L), Seq("test"), Set(10.toByte), 123) | ||
val metaData = XtructColl.metaData | ||
|
||
assert(metaData.codecClass == XtructColl.getClass) // mustEqual doesn't work here | ||
metaData.structClassName mustEqual "thrift.test.XtructColl" | ||
metaData.structName mustEqual "XtructColl" | ||
metaData.structClass mustEqual classOf[XtructColl] | ||
metaData.structClassName must be("thrift.test.XtructColl") | ||
metaData.structName must be("XtructColl") | ||
metaData.structClass must be(classOf[XtructColl]) | ||
|
||
val Seq(f1, f2, f3, f4) = metaData.fields.sortBy(_.id) | ||
|
||
f1.name mustEqual "a_map" | ||
f1.id mustEqual 1 | ||
f1.`type` mustEqual TType.MAP | ||
f1.manifest mustEqual Some(implicitly[Manifest[Map[Int, Long]]]) | ||
f1.getValue[Map[Int, Long]](s) mustEqual Map(1 -> 2L) | ||
|
||
f2.name mustEqual "a_list" | ||
f2.id mustEqual 2 | ||
f2.`type` mustEqual TType.LIST | ||
f2.manifest mustEqual Some(implicitly[Manifest[Seq[String]]]) | ||
f2.getValue[Seq[String]](s) mustEqual Seq("test") | ||
|
||
f3.name mustEqual "a_set" | ||
f3.id mustEqual 3 | ||
f3.`type` mustEqual TType.SET | ||
f3.manifest mustEqual Some(implicitly[Manifest[Set[Byte]]]) | ||
f3.getValue[Set[Byte]](s) mustEqual Set(10.toByte) | ||
|
||
f4.name mustEqual "non_col" | ||
f4.id mustEqual 4 | ||
f4.`type` mustEqual TType.I32 | ||
f4.manifest mustEqual Some(implicitly[Manifest[Int]]) | ||
f4.getValue[Int](s) mustEqual 123 | ||
f1.name must be("a_map") | ||
f1.id must be(1) | ||
f1.`type` must be(TType.MAP) | ||
f1.manifest must be(Some(implicitly[Manifest[Map[Int, Long]]])) | ||
f1.getValue[Map[Int, Long]](s) must be(Map(1 -> 2L)) | ||
|
||
f2.name must be("a_list") | ||
f2.id must be(2) | ||
f2.`type` must be(TType.LIST) | ||
f2.manifest must be(Some(implicitly[Manifest[Seq[String]]])) | ||
f2.getValue[Seq[String]](s) must be(Seq("test")) | ||
|
||
f3.name must be("a_set") | ||
f3.id must be(3) | ||
f3.`type` must be(TType.SET) | ||
f3.manifest must be(Some(implicitly[Manifest[Set[Byte]]])) | ||
f3.getValue[Set[Byte]](s) must be(Set(10.toByte)) | ||
|
||
f4.name must be("non_col") | ||
f4.id must be(4) | ||
f4.`type` must be(TType.I32) | ||
f4.manifest must be(Some(implicitly[Manifest[Int]])) | ||
f4.getValue[Int](s) must be(123) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.