diff --git a/build.sbt b/build.sbt index dbe57cbd..595f4864 100644 --- a/build.sbt +++ b/build.sbt @@ -23,6 +23,7 @@ lazy val `domains-task` = scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}""" ) .dependsOn(`keywords-Shift`, + `keywords-Each` % Test, `keywords-Fork` % Test, `keywords-Using` % Test, `keywords-Yield` % Test, @@ -60,7 +61,7 @@ lazy val `keywords-Continue` = scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""", scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}""" ) - .dependsOn(Dsl) + .dependsOn(Dsl, `keywords-Each` % Test) lazy val `keywords-ContinueJS` = `keywords-Continue`.js lazy val `keywords-ContinueJVM` = `keywords-Continue`.jvm @@ -95,7 +96,7 @@ lazy val `keywords-AsynchronousIo` = scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""", scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}""" ) - .dependsOn(`keywords-Shift`, `comprehension` % Test) + .dependsOn(`keywords-Shift`, `keywords-Each` % Test, `keywords-Using` % Test, `comprehension` % Test, `domains-task` % Test) lazy val `keywords-AsynchronousIoJS` = `keywords-AsynchronousIo`.js lazy val `keywords-AsynchronousIoJVM` = `keywords-AsynchronousIo`.jvm @@ -194,7 +195,7 @@ lazy val `keywords-ForEach` = scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""", scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}""" ) - .dependsOn(Dsl) + .dependsOn(Dsl, `keywords-Each` % Test) lazy val `keywords-ForEachJS` = `keywords-ForEach`.js lazy val `keywords-ForEachJVM` = `keywords-ForEach`.jvm @@ -205,7 +206,7 @@ lazy val `keywords-Each` = scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""", scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}""" ) - .dependsOn(Dsl, `keywords-Shift`, `keywords-Continue` % Test) + .dependsOn(Dsl, `keywords-Shift`) lazy val `keywords-EachJS` = `keywords-Each`.js lazy val `keywords-EachJVM` = `keywords-Each`.jvm @@ -233,7 +234,7 @@ lazy val `keywords-Yield` = scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""", scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}""" ) - .dependsOn(Dsl, `keywords-Shift` % Test, `keywords-Continue` % Test) + .dependsOn(Dsl, `keywords-Shift` % Test, `keywords-Each` % Test, `keywords-Continue` % Test) lazy val `keywords-YieldJS` = `keywords-Yield`.js lazy val `keywords-YieldJVM` = `keywords-Yield`.jvm @@ -289,6 +290,10 @@ lazy val comprehension = `keywords-FlatMap`, `keywords-WithFilter`, `keywords-Return`, + `keywords-Each` % Test, + `keywords-Yield` % Test, + `keywords-Using` % Test, + `keywords-Continue` % Test, ) lazy val comprehensionJS = comprehension.js lazy val comprehensionJVM = comprehension.jvm diff --git a/comprehension/build.sbt b/comprehension/build.sbt index 1def88d2..ff892bd9 100644 --- a/comprehension/build.sbt +++ b/comprehension/build.sbt @@ -16,15 +16,3 @@ scalacOptions in Compile ++= { } libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.6-SNAP2" % Test - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Test - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-asynchronousio" % "1.3.1" % Test - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-yield" % "1.3.1" % Test - -libraryDependencies += "com.thoughtworks.dsl" %%% "domains-task" % "1.3.1" % Optional - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-continue" % "1.3.1" % Test - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-using" % "1.3.1" % Test diff --git a/domains-task/.jvm/jvm.sbt b/domains-task/.jvm/jvm.sbt index 1b90c08e..155e6c6c 100644 --- a/domains-task/.jvm/jvm.sbt +++ b/domains-task/.jvm/jvm.sbt @@ -7,7 +7,3 @@ exampleSuperTypes := exampleSuperTypes.value.map { case otherTrait => otherTrait } - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Optional - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-fork" % "1.3.1" % Optional diff --git a/keywords-AsynchronousIo/build.sbt b/keywords-AsynchronousIo/build.sbt index 2f68a71c..38ad40bd 100644 --- a/keywords-AsynchronousIo/build.sbt +++ b/keywords-AsynchronousIo/build.sbt @@ -7,11 +7,3 @@ scalacOptions ++= { None } } - -libraryDependencies += "com.thoughtworks.dsl" %%% "comprehension" % "1.3.1" % Optional - -libraryDependencies += "com.thoughtworks.dsl" %%% "domains-task" % "1.3.1" % Optional - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-using" % "1.3.1" % Optional - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Optional diff --git a/keywords-Continue/build.sbt b/keywords-Continue/build.sbt index 16efb7d5..a72b81d7 100644 --- a/keywords-Continue/build.sbt +++ b/keywords-Continue/build.sbt @@ -19,5 +19,3 @@ libraryDependencies ++= { Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)) } } - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Test diff --git a/keywords-Each/build.sbt b/keywords-Each/build.sbt index d0df6205..6a73059a 100644 --- a/keywords-Each/build.sbt +++ b/keywords-Each/build.sbt @@ -31,4 +31,3 @@ libraryDependencies ++= { libraryDependencies += "com.thoughtworks.enableIf" %% "enableif" % "1.1.6" -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-yield" % "1.3.1" % Test diff --git a/keywords-Each/src/test/scala/com/thoughtworks/dsl/keywords/EachSpec.scala b/keywords-Each/src/test/scala/com/thoughtworks/dsl/keywords/EachSpec.scala index 653c4ce1..73e04fc9 100644 --- a/keywords-Each/src/test/scala/com/thoughtworks/dsl/keywords/EachSpec.scala +++ b/keywords-Each/src/test/scala/com/thoughtworks/dsl/keywords/EachSpec.scala @@ -151,50 +151,4 @@ class EachSpec extends FreeSpec with Matchers { } } - "Given a continuation that uses Yield and Each expressions" - { - - def asyncFunction: Stream[String] !! Unit = _ { - !Yield("Entering asyncFunction") - val subThreadId: Int = !Each(Seq(0, 1)) - !Yield(s"Fork sub-thread $subThreadId") - !Yield("Leaving asyncFunction") - } - - "When create a generator that contains Yield, Shift, and Each expressions" - { - - def generator: Stream[String] = { - !Yield("Entering generator") - val threadId = !Each(Seq(0, 1)) - !Yield(s"Fork thread $threadId") - !Shift(asyncFunction) - Stream("Leaving generator") - } - - "Then the generator should contains yield values" in { - generator should be( - Seq( - /**/ "Entering generator", - /****/ "Fork thread 0", - /******/ "Entering asyncFunction", - /********/ "Fork sub-thread 0", - /**********/ "Leaving asyncFunction", - /**********/ "Leaving generator", - /********/ "Fork sub-thread 1", - /**********/ "Leaving asyncFunction", - /**********/ "Leaving generator", - /****/ "Fork thread 1", - /******/ "Entering asyncFunction", - /********/ "Fork sub-thread 0", - /**********/ "Leaving asyncFunction", - /**********/ "Leaving generator", - /********/ "Fork sub-thread 1", - /**********/ "Leaving asyncFunction", - /**********/ "Leaving generator" - )) - } - - } - - } - } diff --git a/keywords-ForEach/build.sbt b/keywords-ForEach/build.sbt index 581488df..699fb9a6 100644 --- a/keywords-ForEach/build.sbt +++ b/keywords-ForEach/build.sbt @@ -10,5 +10,3 @@ scalacOptions in Compile ++= { case _ => Seq.empty } } - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Test diff --git a/keywords-Using/build.sbt b/keywords-Using/build.sbt index 8eefca2f..2d4a4864 100644 --- a/keywords-Using/build.sbt +++ b/keywords-Using/build.sbt @@ -19,5 +19,3 @@ scalacOptions ++= { None } } - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-await" % "1.3.1" % Test diff --git a/keywords-Using/src/main/scala/com/thoughtworks/dsl/keywords/Using.scala b/keywords-Using/src/main/scala/com/thoughtworks/dsl/keywords/Using.scala index c8473846..584b839f 100644 --- a/keywords-Using/src/main/scala/com/thoughtworks/dsl/keywords/Using.scala +++ b/keywords-Using/src/main/scala/com/thoughtworks/dsl/keywords/Using.scala @@ -49,11 +49,9 @@ object Using { * Therefore, the final value of `n` should be `(1 + 20) * 2 = 42`. * * {{{ - * import com.thoughtworks.dsl.Dsl.reset - * Future { - * !Await(multiplicationAfterAddition) + * multiplicationAfterAddition.map { _ => * n should be(42) - * }: @reset + * } * }}} * */ diff --git a/keywords-Yield/build.sbt b/keywords-Yield/build.sbt index 378e217f..b1e49767 100644 --- a/keywords-Yield/build.sbt +++ b/keywords-Yield/build.sbt @@ -24,5 +24,3 @@ libraryDependencies ++= { Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)) } } - -libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Test diff --git a/keywords-Yield/src/test/scala/com/thoughtworks/dsl/keywords/YieldSpec.scala b/keywords-Yield/src/test/scala/com/thoughtworks/dsl/keywords/YieldSpec.scala index cc13e32c..915ba8ab 100644 --- a/keywords-Yield/src/test/scala/com/thoughtworks/dsl/keywords/YieldSpec.scala +++ b/keywords-Yield/src/test/scala/com/thoughtworks/dsl/keywords/YieldSpec.scala @@ -13,6 +13,52 @@ import scala.runtime.NonLocalReturnControl */ class YieldSpec extends FreeSpec with Matchers { + "Given a continuation that uses Yield and Each expressions" - { + + def asyncFunction: Stream[String] !! Unit = _ { + !Yield("Entering asyncFunction") + val subThreadId: Int = !Each(Seq(0, 1)) + !Yield(s"Fork sub-thread $subThreadId") + !Yield("Leaving asyncFunction") + } + + "When create a generator that contains Yield, Shift, and Each expressions" - { + + def generator: Stream[String] = { + !Yield("Entering generator") + val threadId = !Each(Seq(0, 1)) + !Yield(s"Fork thread $threadId") + !Shift(asyncFunction) + Stream("Leaving generator") + } + + "Then the generator should contains yield values" in { + generator should be( + Seq( + /**/ "Entering generator", + /****/ "Fork thread 0", + /******/ "Entering asyncFunction", + /********/ "Fork sub-thread 0", + /**********/ "Leaving asyncFunction", + /**********/ "Leaving generator", + /********/ "Fork sub-thread 1", + /**********/ "Leaving asyncFunction", + /**********/ "Leaving generator", + /****/ "Fork thread 1", + /******/ "Entering asyncFunction", + /********/ "Fork sub-thread 0", + /**********/ "Leaving asyncFunction", + /**********/ "Leaving generator", + /********/ "Fork sub-thread 1", + /**********/ "Leaving asyncFunction", + /**********/ "Leaving generator" + )) + } + + } + + } + "stream" - { def shouldCompile = {