Skip to content

Commit c47db3a

Browse files
committed
added sub-project that tests coverageAggregate command
1 parent 7dd8a84 commit c47db3a

File tree

7 files changed

+96
-0
lines changed

7 files changed

+96
-0
lines changed

Diff for: src/sbt-test/scoverage/aggregate/build.sbt

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
The projects test aggregation of coverage reports from two sub-projects.
3+
The sub-projects are in the irectories partA and partB.
4+
The tests are against the sources of ScoverageSbtPlugin in the parent directory.
5+
It might be possible to test other versions of ScoverageSbtPlugin.
6+
*/
7+
8+
lazy val commonSettings = Seq(
9+
organization := "org.scoverage",
10+
version := "0.1.0",
11+
scalaVersion := "2.10.4"
12+
)
13+
14+
lazy val specs2Lib = "org.specs2" %% "specs2" % "2.3.13" % "test"
15+
16+
def module(name: String) = {
17+
val id = s"part$name"
18+
Project(id = id, base = file(id))
19+
.settings(commonSettings: _*)
20+
.settings(
21+
Keys.name := name,
22+
libraryDependencies += specs2Lib
23+
)
24+
}
25+
26+
lazy val partA = module("A")
27+
lazy val partB = module("B")
28+
29+
lazy val root = (project in file("."))
30+
.settings(commonSettings:_*)
31+
.settings(
32+
name := "root",
33+
test := { }
34+
).aggregate(
35+
partA,
36+
partB
37+
)
38+
39+
40+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.scoverage.issue53.part.a
2+
3+
/**
4+
* Created by Mikhail Kokho on 7/10/2015.
5+
*/
6+
object AdderScala {
7+
8+
def add(x: Int, y: Int) = x + y
9+
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import org.specs2.mutable._
2+
import org.scoverage.issue53.part.a.AdderScala
3+
4+
/**
5+
* Created by Mikhail Kokho on 7/10/2015.
6+
*/
7+
class AdderTestSuite extends Specification {
8+
"Adder" should {
9+
"sum two numbers" in {
10+
AdderScala.add(1, 2) mustEqual 3
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
package org.scoverage.issue53.part.b
3+
4+
/**
5+
* Created by Mikhail Kokho on 7/10/2015.
6+
*/
7+
object SubtractorScala {
8+
9+
def minus(x: Int, y: Int) = x - y
10+
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import org.specs2.mutable._
2+
import org.scoverage.issue53.part.b.SubtractorScala
3+
4+
/**
5+
* Created by Mikhail Kokho on 7/10/2015.
6+
*/
7+
class SubtractorTestSuite extends Specification {
8+
"Subtractor" should {
9+
"subtract two numbers" in {
10+
SubtractorScala.minus(2, 1) mustEqual 1
11+
}
12+
}
13+
}
14+

Diff for: src/sbt-test/scoverage/aggregate/project/plugins.sbt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* ScoveragePlugin is constructed from the sources in the parent directory
3+
*/
4+
lazy val root = (project in file(".")).dependsOn(scoveragePlugin)
5+
6+
lazy val scoveragePlugin = file("../../../..").getAbsoluteFile.toURI

Diff for: src/sbt-test/scoverage/aggregate/test

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#this file is necessary for scripted plugin. See http://eed3si9n.com/testing-sbt-plugins
2+
#it is empty for now

0 commit comments

Comments
 (0)