aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-04-13 01:02:52 -0500
committerJesse Luehrs <doy@tozt.net>2013-04-13 01:02:52 -0500
commit7062aa4474b12aaf8e162737e47cd05b7caf18e0 (patch)
treed27926b21b5eb16339ef106535f196754ce5eb0f
parent9df175e35c7cf6ff9f8ad18d87635a0b8e7df5e8 (diff)
downloadscala-test-more-7062aa4474b12aaf8e162737e47cd05b7caf18e0.tar.gz
scala-test-more-7062aa4474b12aaf8e162737e47cd05b7caf18e0.zip
forgot to commit thisHEADmaster
-rw-r--r--src/test/scala/com/iinteractive/test/FormattingTest.scala69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/test/scala/com/iinteractive/test/FormattingTest.scala b/src/test/scala/com/iinteractive/test/FormattingTest.scala
new file mode 100644
index 0000000..a742166
--- /dev/null
+++ b/src/test/scala/com/iinteractive/test/FormattingTest.scala
@@ -0,0 +1,69 @@
+package com.iinteractive.test
+
+import java.io.ByteArrayOutputStream
+
+import com.iinteractive.test.tap.Parser
+
+class FormattingTest extends TestMore {
+ val lineZero = Thread.currentThread.getStackTrace()(1).getLineNumber + 3
+ def line (offset: Int) = lineZero + offset
+
+ private class FormattingTestTest extends TestMore {
+ is(1, 1, "newlines\nwork")
+ is(1, 2, "newlines\nwork")
+
+ diag("newlines\nwork")
+ note("newlines\nwork")
+
+ is(1, 1, "\nnewlines\n")
+ is(1, 2, "\nnewlines\n")
+
+ diag("\nnewlines\n")
+ note("\nnewlines\n")
+ }
+
+ val out = new ByteArrayOutputStream
+ val exitCode = Console.withOut(out) {
+ Console.withErr(out) {
+ (new FormattingTestTest).run
+ }
+ }
+
+ is((new Parser).parse(out).exitCode, 2)
+ is(exitCode, 2)
+
+ val tap =
+ "ok 1 - newlines\n" +
+ "# work\n" +
+ "not ok 2 - newlines\n" +
+ "# work\n" +
+ "# Failed test 'newlines\n" +
+ "# work'\n" +
+ "# at FormattingTest.scala line " + line(2) + ".\n" +
+ "# got: '1'\n" +
+ "# expected: '2'\n" +
+ "# newlines\n" +
+ "# work\n" +
+ "# newlines\n" +
+ "# work\n" +
+ "ok 3 - \n" +
+ "# newlines\n" +
+ "# \n" +
+ "not ok 4 - \n" +
+ "# newlines\n" +
+ "# \n" +
+ "# Failed test '\n" +
+ "# newlines\n" +
+ "# '\n" +
+ "# at FormattingTest.scala line " + line(8) + ".\n" +
+ "# got: '1'\n" +
+ "# expected: '2'\n" +
+ "# \n" +
+ "# newlines\n" +
+ "# \n" +
+ "# newlines\n" +
+ "1..4\n" +
+ "# Looks like you failed 2 tests of 4.\n"
+
+ is(out.toString, tap)
+}