aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-02-20 11:46:01 -0600
committerJesse Luehrs <doy@tozt.net>2013-02-20 11:46:01 -0600
commit03947f5b8ba41fd84cf1c2af2d02bf9e8d8fdd0a (patch)
tree012448275b2322ff2b949b9bb62f3ecfdf2d848c /src/test
parent5f58ec2bfa90dfb833f042f88b1d5ba6ea327a0b (diff)
downloadscala-test-more-03947f5b8ba41fd84cf1c2af2d02bf9e8d8fdd0a.tar.gz
scala-test-more-03947f5b8ba41fd84cf1c2af2d02bf9e8d8fdd0a.zip
add support for subtests
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/basic.scala31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/scala/basic.scala b/src/test/scala/basic.scala
index 1f9fe6d..b9561e2 100644
--- a/src/test/scala/basic.scala
+++ b/src/test/scala/basic.scala
@@ -159,4 +159,35 @@ class Basic extends FunSuite with BeforeAndAfter {
assert(output.toString === expected)
}
+
+ test ("subtests") {
+ val builder = new Builder(output)
+
+ builder.ok(true)
+
+ val subtest = new Builder(output, indent = 1, name = "foo")
+ subtest.ok(true)
+ subtest.ok(false, "do a test")
+ subtest.diag("did a test")
+ subtest.doneTesting
+
+ builder.subtest(subtest)
+
+ builder.ok(false, "something else")
+ builder.doneTesting
+
+ val expected =
+ "ok 1\n" +
+ " ok 1\n" +
+ " not ok 2 do a test\n" +
+ " # did a test\n" +
+ " 1..2\n" +
+ " # Looks like you failed 1 test of 2.\n" +
+ "not ok 2 foo\n" +
+ "not ok 3 something else\n" +
+ "1..3\n" +
+ "# Looks like you failed 2 tests of 3.\n"
+
+ assert(output.toString === expected)
+ }
}