Test::unit caller stack feature request

A typical call stack of mine look like the following.
The last 10 lines is visual noise. Is it possible to get
rid of these lines?

···


Simon Strandgaard

  1. Failure:
    test_repeat_nested14(TestMScanner)
    [./common.rb:64:in assert_regex' ./match_mixins.rb:548:in_debug_test_repeat_nested14’
    (eval):5:in test_repeat_nested14']: <["abababab", "ab"]> expected but was <#<RuntimeError: integrity: expected "a . b", got "a b a b a b a b" at line 4> /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:520:incheck_integrit
    y’
    /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:527:in path_end' /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:577:invisit_last’
    /home/neoneye/kode/editor/projects/regexp_engine/regexp/scanner_nodes.rb:183:in accept' /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:630:infind_match_at’
    /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:639:in match_impl' /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:647:inmatch’
    /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:669:in match_integrity' /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:669:incall’
    /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:657:in check_integrity' /home/neoneye/kode/editor/projects/regexp_engine/regexp/mscanner.rb:669:inmatch_integrity’
    …/common.rb:38:in match_integrity' ../common.rb:55:inassert_regex’
    …/match_mixins.rb:548:in _debug_test_repeat_nested14' (eval):5:intest_repeat_nested14’
    /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/testcase.rb:70:in __send__' /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/testcase.rb:70:inrun’
    /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in run' /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:ineach’
    /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in run' /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:inrun_suite’
    /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:72:in start_mediator' /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:46:instart’
    /home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:21:in `run’
    test_mscanner.rb:93>.

A typical call stack of mine look like the following.
The last 10 lines is visual noise. Is it possible to get
rid of these lines?

Test::Unit is stripping the stack that it has control over:

  1. Failure:
    test_repeat_nested14(TestMScanner)
    [./common.rb:64:in `assert_regex’
    ./match_mixins.rb:548:in `_debug_test_repeat_nested14’
    (eval):5:in `test_repeat_nested14’]:

Note that there is only a three line stack here. The noise below is
somehow being caused by your use of Test::Unit. Why is…

<[“abababab”, “ab”]> expected but was

…an array being compared to…

<#<RuntimeError: integrity: expected “a . b”, got “a b a b a b a b” at
line 4> /home/

… a RuntimeError? Without seeing at least the structure of your code,
I can’t figure out what’s going on, but I don’t think it’s a Test::Unit
issue. I can only make it so smart :slight_smile:

HTH,

Nathaniel

<:((><

···

On Feb 2, 2004, at 08:04, Simon Strandgaard wrote:

A typical call stack of mine look like the following.
The last 10 lines is visual noise. Is it possible to get
rid of these lines?

Test::Unit is stripping the stack that it has control over:

  1. Failure:
    test_repeat_nested14(TestMScanner)
    [./common.rb:64:in `assert_regex’
    ./match_mixins.rb:548:in `_debug_test_repeat_nested14’
    (eval):5:in `test_repeat_nested14’]:

Note that there is only a three line stack here.

Ok. I just never have noticed these lines until now. Earlier I have
looked at the really long stack dump.

The noise below is
somehow being caused by your use of Test::Unit. Why is…

<[“abababab”, “ab”]> expected but was

…an array being compared to…

<#<RuntimeError: integrity: expected “a . b”, got “a b a b a b a b” at
line 4> /home/

… a RuntimeError? Without seeing at least the structure of your code,
I can’t figure out what’s going on, but I don’t think it’s a Test::Unit
issue. I can only make it so smart :slight_smile:

Don’t understand.

The way I use test::unit is…

require ‘test/unit’
class TestMScanner < Test::Unit::TestCase
def test_me
end
end
if $0 == FILE
require ‘test/unit/ui/console/testrunner’
Test::Unit::UI::Console::TestRunner.run(TestMScanner, 3)
end

When I execute it, it results in the long stack dump.
Is it wrong? :slight_smile:

···

On Tue, 03 Feb 2004 00:09:16 +0900, Nathaniel Talbott wrote:

On Feb 2, 2004, at 08:04, Simon Strandgaard wrote:


Simon Strandgaard

I have made my own ‘assert_regex’ method, which checks several things.
In the above case my regexp engine returns too quick without consuming
all of the integrity data.

def assert_regex(expected, regexp_string, input_string, options={})
check_options(options, :integrity_heredoc)
heredoc = options[:integrity_heredoc]
integrity_ary = (heredoc == nil) ? nil : heredoc2ary(heredoc)
actual = nil
actual_str = “nil”
begin
m = compile(regexp_string).match_integrity(
input_string, integrity_ary)
actual = m.to_a if m
actual_str = actual.inspect
rescue => e
actual = e.inspect + " " + e.backtrace.join(“\n”)
actual_str = actual
end
full_message = “<#{expected.inspect}> expected but was\n<#{actual_str}>.”
assert_block(full_message) { expected == actual }
end

Could the problem be located here ?

···

On Tue, 03 Feb 2004 00:09:16 +0900, Nathaniel Talbott wrote:

The noise below is
somehow being caused by your use of Test::Unit. Why is…

<[“abababab”, “ab”]> expected but was

…an array being compared to…

<#<RuntimeError: integrity: expected “a . b”, got “a b a b a b a b” at
line 4> /home/

… a RuntimeError? Without seeing at least the structure of your code,
I can’t figure out what’s going on, but I don’t think it’s a Test::Unit
issue. I can only make it so smart :slight_smile:


Simon Strandgaard

rescue => e
actual = e.inspect + " " + e.backtrace.join(“\n”)

                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                  Ok I found my problem.
                                 don't output the backtrace!
                                      Solved
  actual_str = actual

end

Thanks for the help :slight_smile:

···

On Mon, 02 Feb 2004 16:51:53 +0100, Simon Strandgaard wrote:


Simon Strandgaard

We all have those days… :slight_smile:

Nathaniel

<:((><

···

On Feb 2, 2004, at 11:04, Simon Strandgaard wrote:

On Mon, 02 Feb 2004 16:51:53 +0100, Simon Strandgaard wrote:

rescue => e
actual = e.inspect + " " + e.backtrace.join(“\n”)

                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                  Ok I found my problem.
                                 don't output the backtrace!
                                      Solved
  actual_str = actual

end

Thanks for the help :slight_smile: