From 71bde490ded3c019926c422212689d218dcc9878 Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Wed, 28 Apr 2010 20:39:48 -0400 Subject: [PATCH] Test for projects using continuations --- .../project/continuations/project/build.properties | 2 ++ .../project/build/Continutations.scala | 13 +++++++++++++ .../continuations/src/main/scala/Example.scala | 11 +++++++++++ .../src/test/scala/ContinuationsTest.scala | 11 +++++++++++ sbt/src/sbt-test/project/continuations/test | 5 +++++ 5 files changed, 42 insertions(+) create mode 100644 sbt/src/sbt-test/project/continuations/project/build.properties create mode 100644 sbt/src/sbt-test/project/continuations/project/build/Continutations.scala create mode 100644 sbt/src/sbt-test/project/continuations/src/main/scala/Example.scala create mode 100644 sbt/src/sbt-test/project/continuations/src/test/scala/ContinuationsTest.scala create mode 100644 sbt/src/sbt-test/project/continuations/test diff --git a/sbt/src/sbt-test/project/continuations/project/build.properties b/sbt/src/sbt-test/project/continuations/project/build.properties new file mode 100644 index 000000000..067c60f7c --- /dev/null +++ b/sbt/src/sbt-test/project/continuations/project/build.properties @@ -0,0 +1,2 @@ +project.name=Continuations +project.version=0.1 \ No newline at end of file diff --git a/sbt/src/sbt-test/project/continuations/project/build/Continutations.scala b/sbt/src/sbt-test/project/continuations/project/build/Continutations.scala new file mode 100644 index 000000000..52330016a --- /dev/null +++ b/sbt/src/sbt-test/project/continuations/project/build/Continutations.scala @@ -0,0 +1,13 @@ +import sbt._ + +class Continuations(info: ProjectInfo) extends DefaultProject(info) with AutoCompilerPlugins +{ + val cont = compilerPlugin("org.scala-lang.plugins" % "continuations" % "2.8.0.RC1") + override def compileOptions = super.compileOptions ++ compileOptions("-P:continuations:enable") + + val junit = "junit" % "junit" % "4.7" % "test" + val bryanjswift = "Bryan J Swift Repository" at "http://repos.bryanjswift.com/maven2/" + val junitInterface = "com.novocode" % "junit-interface" % "0.4.0" % "test" + + override def consoleInit = """assert(Examples.x == 20)""" +} \ No newline at end of file diff --git a/sbt/src/sbt-test/project/continuations/src/main/scala/Example.scala b/sbt/src/sbt-test/project/continuations/src/main/scala/Example.scala new file mode 100644 index 000000000..c93d82ac7 --- /dev/null +++ b/sbt/src/sbt-test/project/continuations/src/main/scala/Example.scala @@ -0,0 +1,11 @@ +import scala.util.continuations._ + +object Example { + + val x = + reset { + shift { k: (Int=>Int) => + k(k(k(7))) + } + 1 + } * 2 +} \ No newline at end of file diff --git a/sbt/src/sbt-test/project/continuations/src/test/scala/ContinuationsTest.scala b/sbt/src/sbt-test/project/continuations/src/test/scala/ContinuationsTest.scala new file mode 100644 index 000000000..cb63bcf8c --- /dev/null +++ b/sbt/src/sbt-test/project/continuations/src/test/scala/ContinuationsTest.scala @@ -0,0 +1,11 @@ +import org.junit._ +import Assert._ + +class ContinuationsTest +{ + @Test + def basic + { + assertTrue(Example.x == 20) + } +} \ No newline at end of file diff --git a/sbt/src/sbt-test/project/continuations/test b/sbt/src/sbt-test/project/continuations/test new file mode 100644 index 000000000..fce7f2950 --- /dev/null +++ b/sbt/src/sbt-test/project/continuations/test @@ -0,0 +1,5 @@ +> ++2.8.0.RC1 +> update +> compile +> console +> test-only ContinuationsTest \ No newline at end of file