This file contains hidden or 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
| import org.specs2.mutable._ | |
| class FunctionArgument { | |
| def hoge(func: => AnyRef, condition:Boolean = true) : String = { | |
| if (condition) { | |
| func.toString | |
| } else { | |
| "false" | |
| } | |
| } |
This file contains hidden or 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
| class Hoge() {}; var hoge = List(new Hoge()); hoge foldLeft(Map[String, Hoge]()) ( (map:Map[String,Hoge], hoge:Hoge) => map + ("hoge" -> hoge) ); |
This file contains hidden or 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
| import sbt._ | |
| import Keys._ | |
| import com.github.retronym.SbtOneJar | |
| import scala._ | |
| object Build extends Build { | |
| val specs = "org.specs2" %% "specs2" % "1.9" % "test" | |
| val specsResolver = Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", | |
| "releases" at "http://oss.sonatype.org/content/repositories/releases") | |
| val mysqlDriver = "mysql" % "mysql-connector-java" % "5.1.19" % "runtime" |
This file contains hidden or 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
| val hello = TaskKey[Unit]("hello") | |
| val helloTask = hello <<= streams map { (s: TaskStreams) => | |
| s.log.info("Hello!") | |
| println("hello") | |
| } | |
| val compile = TaskKey[Unit]("compile") | |
| compile <<= (compile in Compile) dependsOn (hello) |
This file contains hidden or 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
| import org.specs2.mutable._ | |
| class SpecsStudyTest extends Specification with Tags { | |
| "world" should { | |
| "have 5 characters" in { | |
| "world".size must_== 5 | |
| } | |
| "is beutiful" in { | |
| "world" must_== "beutiful" | |
| } |
This file contains hidden or 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
| trait ApiInjector { | |
| var twitter : TwitterApi = new TwitterApiImpl; | |
| //他にもいろいろなサービス | |
| } |
This file contains hidden or 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
| import sbt._ | |
| import Keys._ | |
| import com.github.retronym.SbtOneJar | |
| object AggregateBuild extends Build { | |
| val specs = "org.specs2" %% "specs2" % "1.9" % "test" | |
| val specsResolver = Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", | |
| "releases" at "http://oss.sonatype.org/content/repositories/releases") | |
| lazy val dependencies = Seq(specs) |
This file contains hidden or 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
| trait Base extends App { | |
| def doRun(args:Array[String]); | |
| doRun(args) | |
| } | |
| object ConcreteClass extends Base { | |
| def doRun(args:Array[String]) { | |
| println(args) | |
| } | |
| } |
NewerOlder