aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-02-23 16:21:00 -0600
committerJesse Luehrs <doy@tozt.net>2013-02-23 16:21:11 -0600
commitf774c072d0a6b5b403289e3db72eb3d57ee15099 (patch)
tree5247fd15348ca676fbcb01571a08240cf642669b /src/test
parent073d5a06c07c85c0d1794c4a15d564e8463b31fc (diff)
downloadscala-test-more-f774c072d0a6b5b403289e3db72eb3d57ee15099.tar.gz
scala-test-more-f774c072d0a6b5b403289e3db72eb3d57ee15099.zip
make tap line numbers more stable in these tests
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/org/perl8/test/ExtensionTest.scala7
-rw-r--r--src/test/scala/org/perl8/test/TestMoreTest.scala29
2 files changed, 21 insertions, 15 deletions
diff --git a/src/test/scala/org/perl8/test/ExtensionTest.scala b/src/test/scala/org/perl8/test/ExtensionTest.scala
index 6455e16..bf1c17f 100644
--- a/src/test/scala/org/perl8/test/ExtensionTest.scala
+++ b/src/test/scala/org/perl8/test/ExtensionTest.scala
@@ -21,6 +21,9 @@ trait NumberZeroWrapped extends NumberZero { this: TestMore =>
}
class ExtensionTest extends TestMore {
+ val lineZero = Thread.currentThread.getStackTrace()(1).getLineNumber + 3
+ def line (offset: Int) = lineZero + offset
+
private class ExtensionTestTest extends TestMore with NumberZeroWrapped {
is_zero(0, "it's zero")
is_zero(1, "it's not zero")
@@ -41,13 +44,13 @@ class ExtensionTest extends TestMore {
"ok 1 - it's zero\n" +
"not ok 2 - it's not zero\n" +
"# Failed test 'it's not zero'\n" +
- "# at ExtensionTest.scala line 26.\n" +
+ "# at ExtensionTest.scala line " + line(2) + ".\n" +
"# got: '1'\n" +
"# expected: '0'\n" +
"ok 3 - the number is zero\n" +
"not ok 4 - the number is zero\n" +
"# Failed test 'the number is zero'\n" +
- "# at ExtensionTest.scala line 28.\n" +
+ "# at ExtensionTest.scala line " + line(4) + ".\n" +
"# got: '1'\n" +
"# expected: '0'\n" +
"1..4\n" +
diff --git a/src/test/scala/org/perl8/test/TestMoreTest.scala b/src/test/scala/org/perl8/test/TestMoreTest.scala
index a72c18b..7ee183a 100644
--- a/src/test/scala/org/perl8/test/TestMoreTest.scala
+++ b/src/test/scala/org/perl8/test/TestMoreTest.scala
@@ -9,6 +9,9 @@ class TestMoreTest extends TestMore {
val output = new ByteArrayOutputStream
}
+ val lineZero = Thread.currentThread.getStackTrace()(1).getLineNumber + 3
+ def line (offset: Int) = lineZero + offset
+
private class MyBasicTest extends TestMore {
diag("ok")
ok(1 == 1, "it works!")
@@ -71,63 +74,63 @@ class TestMoreTest extends TestMore {
"ok 1 - it works!\n" +
"not ok 2 - it doesn't work!\n" +
"# Failed test 'it doesn't work!'\n" +
- "# at TestMoreTest.scala line 15.\n" +
+ "# at TestMoreTest.scala line " + line(3) + ".\n" +
"ok 3\n" +
"not ok 4\n" +
- "# Failed test at TestMoreTest.scala line 17.\n" +
+ "# Failed test at TestMoreTest.scala line " + line(5) + ".\n" +
"# is\n" +
"ok 5 - it works!\n" +
"not ok 6 - it doesn't work!\n" +
"# Failed test 'it doesn't work!'\n" +
- "# at TestMoreTest.scala line 21.\n" +
+ "# at TestMoreTest.scala line " + line(9) + ".\n" +
"# got: '1'\n" +
"# expected: '0'\n" +
"ok 7\n" +
"not ok 8\n" +
- "# Failed test at TestMoreTest.scala line 23.\n" +
+ "# Failed test at TestMoreTest.scala line " + line(11) + ".\n" +
"# got: '1'\n" +
"# expected: '0'\n" +
"# isnt\n" +
"ok 9 - it works!\n" +
"not ok 10 - it doesn't work!\n" +
"# Failed test 'it doesn't work!'\n" +
- "# at TestMoreTest.scala line 27.\n" +
+ "# at TestMoreTest.scala line " + line(15) + ".\n" +
"# got: '1'\n" +
"# expected: anything else\n" +
"ok 11\n" +
"not ok 12\n" +
- "# Failed test at TestMoreTest.scala line 29.\n" +
+ "# Failed test at TestMoreTest.scala line " + line(17) + ".\n" +
"# got: '1'\n" +
"# expected: anything else\n" +
"# like\n" +
"ok 13 - it works!\n" +
"not ok 14 - it doesn't work!\n" +
"# Failed test 'it doesn't work!'\n" +
- "# at TestMoreTest.scala line 33.\n" +
+ "# at TestMoreTest.scala line " + line(21) + ".\n" +
"# 'foo'\n" +
"# doesn't match 'bar'\n" +
"ok 15\n" +
"not ok 16\n" +
- "# Failed test at TestMoreTest.scala line 35.\n" +
+ "# Failed test at TestMoreTest.scala line " + line(23) + ".\n" +
"# 'foo'\n" +
"# doesn't match 'bar'\n" +
" # unlike\n" +
" ok 1 - it works!\n" +
" not ok 2 - it doesn't work!\n" +
" # Failed test 'it doesn't work!'\n" +
- " # at TestMoreTest.scala line 40.\n" +
+ " # at TestMoreTest.scala line " + line(28) + ".\n" +
" # 'foo'\n" +
" # matches 'foo'\n" +
" ok 3\n" +
" not ok 4\n" +
- " # Failed test at TestMoreTest.scala line 42.\n" +
+ " # Failed test at TestMoreTest.scala line " + line(30) + ".\n" +
" # 'foo'\n" +
" # matches 'foo'\n" +
" 1..4\n" +
" # Looks like you failed 2 tests of 4.\n" +
"not ok 17 - unlikes\n" +
"# Failed test 'unlikes'\n" +
- "# at TestMoreTest.scala line 37.\n" +
+ "# at TestMoreTest.scala line " + line(25) + ".\n" +
"# pass\n" +
"ok 18 - it works!\n" +
"ok 19\n" +
@@ -136,9 +139,9 @@ class TestMoreTest extends TestMore {
"# fail\n" +
"not ok 22 - it doesn't work # TODO not working yet\n" +
"# Failed (TODO) test 'it doesn't work'\n" +
- "# at TestMoreTest.scala line 56.\n" +
+ "# at TestMoreTest.scala line " + line(44) + ".\n" +
"not ok 23 # TODO not working yet\n" +
- "# Failed (TODO) test at TestMoreTest.scala line 57.\n" +
+ "# Failed (TODO) test at TestMoreTest.scala line " + line(45) + ".\n" +
"1..23\n" +
"# Looks like you failed 9 tests of 23.\n"