Created
May 30, 2012 06:45
-
-
Save yamashiro/2834130 to your computer and use it in GitHub Desktop.
どういう変換が起こっているのかわからない…
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
import org.specs2.mutable._ | |
class FunctionArgument { | |
def hoge(func: => AnyRef, condition:Boolean = true) : String = { | |
if (condition) { | |
func.toString | |
} else { | |
"false" | |
} | |
} | |
} | |
class FunctionArgumentTest extends Specification { | |
val target = new FunctionArgument() | |
"FunctionArgument " should { | |
"hoge can call " in { | |
target.hoge("aaa") must_== "aaa" | |
} | |
"hoge can call to pass false " in { | |
target.hoge("aaa", false) must_== "false" | |
} | |
"hoge can call with func " in { | |
def bbb() : String = { "bbb" } | |
target.hoge("aaa" + bbb) must_== "aaabbb" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment