test::unit caller stack feature request

  • Thread starter Simon Strandgaard
  • Start date
S

Simon Strandgaard

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:in `check_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:in `visit_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:in `find_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:in `match'
/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:in `call'
/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:in `match_integrity'
../common.rb:38:in `match_integrity'
../common.rb:55:in `assert_regex'
../match_mixins.rb:548:in `_debug_test_repeat_nested14'
(eval):5:in `test_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:in `run'
/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:in `each'
/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:in `run_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:in `start'
/home/neoneye/stow/ruby/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:21:in `run'
test_mscanner.rb:93>.
 
N

Nathaniel Talbott

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 :)

HTH,


Nathaniel

<:((><
 
S

Simon Strandgaard

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 :)

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? :)
 
S

Simon Strandgaard

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 :)

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 ?
 
N

Nathaniel Talbott

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




Thanks for the help :)

We all have those days... :)


Nathaniel

<:((><
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top