From 7a00ccf0a468cd74543e3c65f8ebecab9629e10d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 14 Mar 2013 11:41:34 -0500 Subject: diag and note should be able to stringify anything fixes gh-1 --- .../scala/com/iinteractive/test/TestMoreTest.scala | 3 +++ .../com/iinteractive/test/tap/TestBuilderTest.scala | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src/test') diff --git a/src/test/scala/com/iinteractive/test/TestMoreTest.scala b/src/test/scala/com/iinteractive/test/TestMoreTest.scala index ead9823..22bddc3 100644 --- a/src/test/scala/com/iinteractive/test/TestMoreTest.scala +++ b/src/test/scala/com/iinteractive/test/TestMoreTest.scala @@ -55,6 +55,8 @@ class TestMoreTest extends TestMore { fail("it doesn't work") fail } + + diag(List(1, "foo")) } val out = new ByteArrayOutputStream @@ -140,6 +142,7 @@ class TestMoreTest extends TestMore { "# at TestMoreTest.scala line " + line(44) + ".\n" + "not ok 23 # TODO not working yet\n" + "# Failed (TODO) test at TestMoreTest.scala line " + line(45) + ".\n" + + "# List(1, foo)\n" + "1..23\n" + "# Looks like you failed 9 tests of 23.\n" diff --git a/src/test/scala/com/iinteractive/test/tap/TestBuilderTest.scala b/src/test/scala/com/iinteractive/test/tap/TestBuilderTest.scala index bc873c8..b1f23c9 100644 --- a/src/test/scala/com/iinteractive/test/tap/TestBuilderTest.scala +++ b/src/test/scala/com/iinteractive/test/tap/TestBuilderTest.scala @@ -70,6 +70,9 @@ class TestBuilderTest extends TestMore { } subtest ("diag") { + class Foo { + override def toString = "stringified" + } val output = new ByteArrayOutputStream Console.withOut(output) { Console.withErr(output) { @@ -78,19 +81,23 @@ class TestBuilderTest extends TestMore { builder.ok(false, "the test passes") builder.diag("got false, expected true") builder.ok(true) + builder.diag(List(1, "foo", Nil, ('a', 2.3))) + builder.diag(new Foo) builder.diag("ending\nnow") builder.doneTesting } } val expected = - "ok 1 the test passes\n" + - "not ok 2 the test passes\n" + - "# got false, expected true\n" + - "ok 3\n" + - "# ending\n" + - "# now\n" + - "1..3\n" + + "ok 1 the test passes\n" + + "not ok 2 the test passes\n" + + "# got false, expected true\n" + + "ok 3\n" + + "# List(1, foo, List(), (a,2.3))\n" + + "# stringified\n" + + "# ending\n" + + "# now\n" + + "1..3\n" + "# Looks like you failed 1 test of 3.\n" is(output.toString, expected) -- cgit v1.2.3-54-g00ecf