Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added sub-project that tests coverageAggregate command #118

Merged
merged 1 commit into from
Jul 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/sbt-test/scoverage/aggregate/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
The projects test aggregation of coverage reports from two sub-projects.
The sub-projects are in the irectories partA and partB.
The tests are against the sources of ScoverageSbtPlugin in the parent directory.
It might be possible to test other versions of ScoverageSbtPlugin.
*/

lazy val commonSettings = Seq(
organization := "org.scoverage",
version := "0.1.0",
scalaVersion := "2.10.4"
)

lazy val specs2Lib = "org.specs2" %% "specs2" % "2.3.13" % "test"

def module(name: String) = {
val id = s"part$name"
Project(id = id, base = file(id))
.settings(commonSettings: _*)
.settings(
Keys.name := name,
libraryDependencies += specs2Lib
)
}

lazy val partA = module("A")
lazy val partB = module("B")

lazy val root = (project in file("."))
.settings(commonSettings:_*)
.settings(
name := "root",
test := { }
).aggregate(
partA,
partB
)



Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.scoverage.issue53.part.a

/**
* Created by Mikhail Kokho on 7/10/2015.
*/
object AdderScala {

def add(x: Int, y: Int) = x + y

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import org.specs2.mutable._
import org.scoverage.issue53.part.a.AdderScala

/**
* Created by Mikhail Kokho on 7/10/2015.
*/
class AdderTestSuite extends Specification {
"Adder" should {
"sum two numbers" in {
AdderScala.add(1, 2) mustEqual 3
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

package org.scoverage.issue53.part.b

/**
* Created by Mikhail Kokho on 7/10/2015.
*/
object SubtractorScala {

def minus(x: Int, y: Int) = x - y

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import org.specs2.mutable._
import org.scoverage.issue53.part.b.SubtractorScala

/**
* Created by Mikhail Kokho on 7/10/2015.
*/
class SubtractorTestSuite extends Specification {
"Subtractor" should {
"subtract two numbers" in {
SubtractorScala.minus(2, 1) mustEqual 1
}
}
}

6 changes: 6 additions & 0 deletions src/sbt-test/scoverage/aggregate/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* ScoveragePlugin is constructed from the sources in the parent directory
*/
lazy val root = (project in file(".")).dependsOn(scoveragePlugin)

lazy val scoveragePlugin = file("../../../..").getAbsoluteFile.toURI
2 changes: 2 additions & 0 deletions src/sbt-test/scoverage/aggregate/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#this file is necessary for scripted plugin. See http://eed3si9n.com/testing-sbt-plugins
#it is empty for now