-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from fiadliel/add_tests
Update some logic, adds tests
- Loading branch information
Showing
33 changed files
with
199 additions
and
10 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
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
sbt.version=0.13.16 | ||
|
||
sbt.version=1.1.6 |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1") | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") | ||
|
||
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value |
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
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,8 @@ | ||
object Test { | ||
def foo[F[_], A](fa: F[A]): String = | ||
fa.toString | ||
|
||
foo { x: Int => | ||
x * 2 | ||
} | ||
} |
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 @@ | ||
scalaVersion := "2.10.7" |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-partial-unification/2_10_7/project/plugins.sbt
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,2 @@ | ||
addSbtPlugin( | ||
"org.lyranthe.sbt" % "partial-unification" % sys.props("plugin.version")) |
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 @@ | ||
> compile |
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,8 @@ | ||
object Test { | ||
def foo[F[_], A](fa: F[A]): String = | ||
fa.toString | ||
|
||
foo { x: Int => | ||
x * 2 | ||
} | ||
} |
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 @@ | ||
scalaVersion := "2.11.11" |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-partial-unification/2_11_11/project/plugins.sbt
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,2 @@ | ||
addSbtPlugin( | ||
"org.lyranthe.sbt" % "partial-unification" % sys.props("plugin.version")) |
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 @@ | ||
> compile |
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,8 @@ | ||
object Test { | ||
def foo[F[_], A](fa: F[A]): String = | ||
fa.toString | ||
|
||
foo { x: Int => | ||
x * 2 | ||
} | ||
} |
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 @@ | ||
scalaVersion := "2.11.8" |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-partial-unification/2_11_8/project/plugins.sbt
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,2 @@ | ||
addSbtPlugin( | ||
"org.lyranthe.sbt" % "partial-unification" % sys.props("plugin.version")) |
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 @@ | ||
> compile |
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,8 @@ | ||
object Test { | ||
def foo[F[_], A](fa: F[A]): String = | ||
fa.toString | ||
|
||
foo { x: Int => | ||
x * 2 | ||
} | ||
} |
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 @@ | ||
scalaVersion := "2.12.6" |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-partial-unification/2_12_6/project/plugins.sbt
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,2 @@ | ||
addSbtPlugin( | ||
"org.lyranthe.sbt" % "partial-unification" % sys.props("plugin.version")) |
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 @@ | ||
> compile |
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,8 @@ | ||
object Test { | ||
def foo[F[_], A](fa: F[A]): String = | ||
fa.toString | ||
|
||
foo { x: Int => | ||
x * 2 | ||
} | ||
} |
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 @@ | ||
scalaVersion := "2.13.0-M3" |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-partial-unification/2_13_0_M3/project/plugins.sbt
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,2 @@ | ||
addSbtPlugin( | ||
"org.lyranthe.sbt" % "partial-unification" % sys.props("plugin.version")) |
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 @@ | ||
> compile |
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,8 @@ | ||
object Test { | ||
def foo[F[_], A](fa: F[A]): String = | ||
fa.toString | ||
|
||
foo { x: Int => | ||
x * 2 | ||
} | ||
} |
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 @@ | ||
scalaVersion := "2.13.0-M4" |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-partial-unification/2_13_0_M4/project/plugins.sbt
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,2 @@ | ||
addSbtPlugin( | ||
"org.lyranthe.sbt" % "partial-unification" % sys.props("plugin.version")) |
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 @@ | ||
> compile |
8 changes: 8 additions & 0 deletions
8
src/sbt-test/sbt-partial-unification/dotty_0_9_0_RC1/Main.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,8 @@ | ||
object Test { | ||
def foo[F[_], A](fa: F[A]): String = | ||
fa.toString | ||
|
||
foo { x: Int => | ||
x * 2 | ||
} | ||
} |
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 @@ | ||
scalaVersion := "0.9.0-RC1" |
4 changes: 4 additions & 0 deletions
4
src/sbt-test/sbt-partial-unification/dotty_0_9_0_RC1/project/plugins.sbt
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,4 @@ | ||
addSbtPlugin( | ||
"org.lyranthe.sbt" % "partial-unification" % sys.props("plugin.version")) | ||
|
||
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.2.2") |
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 @@ | ||
> compile |
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,86 @@ | ||
package org.lyranthe.sbt | ||
|
||
import org.lyranthe.sbt.PartialUnification.Resolution | ||
import org.scalatest.{Assertion, FlatSpec, Matchers} | ||
import sbt._ | ||
|
||
class PartialUnificationSpec extends FlatSpec with Matchers { | ||
|
||
val partialUnificationPlugin: ModuleID = | ||
"com.milessabin" % "si2712fix-plugin" % "1.2.0" | ||
|
||
def pluginOrFlag(scalaVersion: String): PartialUnification.Resolution = | ||
PartialUnification.pluginOrFlag(scalaVersion, partialUnificationPlugin) | ||
|
||
def shouldFail(scalaVersion: String): Assertion = { | ||
a[RuntimeException] shouldBe thrownBy(pluginOrFlag(scalaVersion)) | ||
} | ||
|
||
def shouldReturnPlugin(scalaVersion: String): Assertion = { | ||
pluginOrFlag(scalaVersion) shouldBe a[Resolution.Plugin] | ||
} | ||
|
||
def shouldReturnFlag(scalaVersion: String): Assertion = { | ||
pluginOrFlag(scalaVersion) shouldBe a[Resolution.Flag] | ||
} | ||
|
||
def shouldDoNothing(scalaVersion: String): Assertion = { | ||
pluginOrFlag(scalaVersion) shouldBe a[Resolution.NothingHappens.type] | ||
} | ||
|
||
"Scala version" should "not match 2.10.0" in { | ||
shouldFail("2.10.0") | ||
} | ||
|
||
it should "choose plugin 2.10.6" in { | ||
shouldReturnPlugin("2.10.6") | ||
} | ||
|
||
it should "choose plugin for 2.10.7" in { | ||
shouldReturnPlugin("2.10.7") | ||
} | ||
|
||
it should "not match 2.11.7" in { | ||
shouldFail("2.11.7") | ||
} | ||
|
||
it should "choose plugin for 2.11.8" in { | ||
shouldReturnPlugin("2.11.8") | ||
} | ||
|
||
it should "choose flag for 2.11.9" in { | ||
shouldReturnFlag("2.11.9") | ||
} | ||
|
||
it should "choose flag for 2.12.0" in { | ||
shouldReturnFlag("2.12.0") | ||
} | ||
|
||
it should "choose flag for 2.13.0-M1" in { | ||
shouldReturnFlag("2.13.0-M1") | ||
} | ||
|
||
it should "choose flag for 2.13.0-M2" in { | ||
shouldReturnFlag("2.13.0-M2") | ||
} | ||
|
||
it should "choose flag for 2.13.0-M3" in { | ||
shouldReturnFlag("2.13.0-M3") | ||
} | ||
|
||
it should "do nothing for 2.13.0-M4" in { | ||
shouldDoNothing("2.13.0-M4") | ||
} | ||
|
||
it should "do nothing for 2.13.0" in { | ||
shouldDoNothing("2.13.0") | ||
} | ||
|
||
it should "do nothing for 2.13.1-M1" in { | ||
shouldDoNothing("2.13.1-M1") | ||
} | ||
|
||
it should "do nothing for 3.0.0" in { | ||
shouldDoNothing("3.0.0") | ||
} | ||
} |