File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ libraryDependencies ++= Seq(
10
10
" commons-io" % " commons-io" % " 2.4" ,
11
11
" org.scala-lang" % " scala-compiler" % " 2.10.3" % " provided" ,
12
12
" org.scalatest" %% " scalatest" % " 2.1.0" % " test" ,
13
- " org.mockito" % " mockito-all" % " 1.9.5" % " test"
13
+ " org.mockito" % " mockito-all" % " 1.9.5" % " test" ,
14
+ " joda-time" % " joda-time" % " 2.2" % " test" ,
15
+ " org.joda" % " joda-convert" % " 1.3.1" % " test"
14
16
)
15
17
16
18
publishMavenStyle := true
Original file line number Diff line number Diff line change @@ -64,4 +64,27 @@ class PluginASTSupportTest
64
64
|} """ .stripMargin)
65
65
assert(! reporter.hasErrors)
66
66
}
67
+
68
+ test(" scoverage supports joda time #23" ) {
69
+ addToClassPath(" org.joda" , " joda-convert" , " 1.3.1" )
70
+ addToClassPath(" joda-time" , " joda-time" , " 2.3" )
71
+ compileCodeSnippet( """ class Test {
72
+ |
73
+ | import org.joda.time.LocalDate
74
+ | import org.joda.time.DateTime
75
+ |
76
+ | case class Member(id: Long,
77
+ | name: String,
78
+ | activated: Boolean,
79
+ | luckyNumber: Option[Long] = None,
80
+ | birthday: Option[LocalDate] = None,
81
+ | createdAt: DateTime,
82
+ | updatedAt: DateTime)
83
+ |} """ .stripMargin)
84
+
85
+ assert(! reporter.hasErrors)
86
+
87
+ }
67
88
}
89
+
90
+
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ trait PluginSupport {
27
27
file
28
28
}
29
29
30
+ def addToClassPath (groupId : String , artifactId : String , version : String ): Unit = {
31
+ settings.classpath.value = settings.classpath.value + " :" + findIvyJar(groupId, artifactId, version).getAbsolutePath
32
+ }
33
+
30
34
def compileCodeSnippet (code : String ): ScoverageAwareCompiler = compileSourceFiles(writeCodeSnippetToTempFile(code))
31
35
32
36
def compileSourceFiles (files : File * ): ScoverageAwareCompiler = {
@@ -48,6 +52,14 @@ trait PluginSupport {
48
52
if (file.exists) file else throw new FileNotFoundException (s " Could not locate [ $jarName]. Tests require SBT 0.13+ " )
49
53
}
50
54
55
+ def findIvyJar (groupId : String , artifactId : String , version : String ): File = {
56
+ val userHome = System .getProperty(" user.home" )
57
+ val sbtHome = userHome + " /.ivy2"
58
+ val jarPath = sbtHome + " /cache/" + groupId + " /" + artifactId + " /jars/" + artifactId + " -" + version + " .jar"
59
+ val file = new File (jarPath)
60
+ if (file.exists) file else throw new FileNotFoundException (s " Could not locate [ $jarPath]. Tests require SBT 0.13+ " )
61
+ }
62
+
51
63
def sbtCompileDir : File = {
52
64
val dir = new File (" ./target/scala-" + shortScalaVersion + " /classes" )
53
65
if (dir.exists) dir
You can’t perform that action at this time.
0 commit comments