-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic build script and some example tests.
- Loading branch information
Showing
5 changed files
with
105 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name := "gameoflife" | ||
|
||
version := "0.0" | ||
|
||
organization := "org.agilefinland.oulu" | ||
|
||
|
||
libraryDependencies ++= Seq( | ||
"org.specs2" %% "specs2" % "1.8.2" % "test", | ||
"org.scalatest" %% "scalatest" % "1.7.1" % "test" | ||
) | ||
|
||
resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", | ||
"releases" at "http://oss.sonatype.org/content/repositories/releases" | ||
) |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/" | ||
|
||
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0") |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.agilefinland.gameoflife | ||
|
||
class Main { | ||
def foo() : Int = { | ||
0 | ||
} | ||
} | ||
object Main extends App { | ||
println("Hello World!") | ||
} |
63 changes: 63 additions & 0 deletions
63
src/test/scala/org/agilefinland/gameoflife/MainScalaTest.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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.agilefinland.gameoflife | ||
|
||
import org.specs2.matcher.ShouldMatchers | ||
import org.scalatest.matchers.MustMatchers | ||
import org.scalatest.GivenWhenThen | ||
import org.scalatest.{FeatureSpec, FunSpec, FunSuite} | ||
|
||
class MainScalaTest extends FunSuite { | ||
|
||
test("foo returns 0") { | ||
val m = new Main | ||
assert(m.foo == 0) | ||
} | ||
|
||
} | ||
|
||
class MainScalaTestShould extends FunSuite with ShouldMatchers { | ||
|
||
test("foo returns 0") { | ||
val m = new Main | ||
m.foo should equalTo(0) | ||
} | ||
} | ||
|
||
class MainScalaTestMust extends FunSuite with MustMatchers { | ||
|
||
test("foo returns 0") { | ||
val m = new Main | ||
m.foo must equal(0) | ||
} | ||
} | ||
|
||
class MainScalaTesBdd extends FunSpec with MustMatchers { | ||
|
||
describe("A main class") { | ||
it("should return 0 when 'foo' is called") { | ||
val m = new Main | ||
m.foo must equal(0) | ||
} | ||
|
||
it("should make coffee when 'bar' is called") ( pending ) | ||
|
||
} | ||
} | ||
|
||
class MainScalaTesSpec extends FeatureSpec with GivenWhenThen with MustMatchers { | ||
|
||
info("as a programmer") | ||
info("I want to get zero") | ||
info("when I call 'foo'") | ||
feature("Main::foo returns 0") { | ||
scenario("should return 0 when 'foo' is called") { | ||
given("A Main class") | ||
val m = new Main | ||
when("foo is called") | ||
val foo: Int = m.foo | ||
then("value must be 0") | ||
foo must equal(0) | ||
} | ||
|
||
|
||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/test/scala/org/agilefinland/gameoflife/MainSpecs2Test.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.agilefinland.gameoflife | ||
|
||
import org.specs2.mutable.Specification | ||
|
||
class MainSpecs2Test extends Specification { | ||
|
||
"Main class" should { | ||
"'foo' should return 0" in { | ||
val m = new Main | ||
m.foo === 0 | ||
} | ||
} | ||
|
||
} |