aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/scala/com/iinteractive/test/package.scala
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-03-06 15:32:26 -0600
committerJesse Luehrs <doy@tozt.net>2013-03-06 15:32:26 -0600
commit7efb2caf7d8832a7d3a9d2ac55862e43267a3eb2 (patch)
tree49fcb4d31bec67bcb67c1262abc25c5e5ecb1e51 /src/main/scala/com/iinteractive/test/package.scala
parent66bcf3627a38ef58dabaf90b7e597569b91ea3e8 (diff)
downloadscala-test-more-7efb2caf7d8832a7d3a9d2ac55862e43267a3eb2.tar.gz
scala-test-more-7efb2caf7d8832a7d3a9d2ac55862e43267a3eb2.zip
move the directory structure too
Diffstat (limited to 'src/main/scala/com/iinteractive/test/package.scala')
-rw-r--r--src/main/scala/com/iinteractive/test/package.scala74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/main/scala/com/iinteractive/test/package.scala b/src/main/scala/com/iinteractive/test/package.scala
new file mode 100644
index 0000000..df077f2
--- /dev/null
+++ b/src/main/scala/com/iinteractive/test/package.scala
@@ -0,0 +1,74 @@
+package com.iinteractive
+
+/** This library implements several components of Perl's testing ecosystem in
+ * Scala. The most useful place to get started to use this library is likely
+ * [[com.iinteractive.test.TestMore TestMore]].
+ */
+package object test {
+ import language.implicitConversions
+
+ /** Converts an
+ * [[http://www.scala-lang.org/api/current/index.html#scala.Int Int]] to a
+ * [[NumericPlan]].
+ */
+ implicit def intToPlan (p: Int): Plan =
+ NumericPlan(p)
+
+ /** A test plan. This represents the TAP statement telling how many tests
+ * will be run.
+ */
+ sealed trait Plan {
+ /** How many tests will be run. */
+ val plan: Int
+ /** Whether this test was skipped. It should contain `Some(message)` if
+ * the test is skipped, and `None` otherwise.
+ */
+ val skipAll: Option[String]
+ }
+
+ /** An explicit plan number. Corresponds to `1..5` in TAP. */
+ case class NumericPlan (plan: Int) extends Plan {
+ /** @inheritdoc
+ *
+ * Always `None` for this class.
+ */
+ val skipAll = None
+ }
+
+ /** A test which did not declare a plan yet. */
+ case object NoPlan extends Plan {
+ /** @inheritdoc
+ *
+ * Always 0 for this class.
+ */
+ val plan = 0
+ /** @inheritdoc
+ *
+ * Always `None` for this class.
+ */
+ val skipAll = None
+ }
+
+ /** A test which has declared that the entire test has been skipped.
+ * Corresponds to `1..0 # SKIP [message]` in TAP.
+ */
+ case class SkipAll (message: String) extends Plan {
+ /** @inheritdoc
+ *
+ * Always 0 for this class.
+ */
+ val plan = 0
+ /** @inheritdoc
+ *
+ * Never `None` for this class.
+ */
+ val skipAll = Some(message)
+ }
+
+ /** Exception thrown when a test bails out. Corresponds to
+ * `Bail out! [message]` in TAP.
+ */
+ case class BailOutException (
+ message: String
+ ) extends RuntimeException(message)
+}