Professional Web Applications Themes

test::unit caller stack feature request - Ruby

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' ...

  1. #1

    Default 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: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>.
    Simon Guest

  2. #2

    Default Re: test::unit caller stack feature request

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

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

    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...
     

    ...an array being compared to...
     

    ... 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

    <:((><



    Nathaniel Guest

  3. #3

    Default Re: test::unit caller stack feature request

    On Tue, 03 Feb 2004 00:09:16 +0900, Nathaniel Talbott wrote:
     
    >
    > Test::Unit _is_ stripping the stack that it has control over:

    >
    > Note that there is only a three line stack here.[/ref]

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

     
    >
    > ..an array being compared to...

    >
    > .. 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 :-)[/ref]

    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(TestMScann er, 3)
    end

    When I execute it, it results in the _long_ stack dump.
    Is it wrong? :-)

    --
    Simon Strandgaard

    Simon Guest

  4. #4

    Default Re: test::unit caller stack feature request

    > On Tue, 03 Feb 2004 00:09:16 +0900, Nathaniel Talbott wrote: 
    >>
    >> ..an array being compared to...
    >> 
    >>
    >> .. 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 :-)[/ref][/ref]

    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 ?

    --
    Simon Strandgaard
    Simon Guest

  5. #5

    Default Re: test::unit caller stack feature request

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

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

     


    Thanks for the help :-)


    --
    Simon Strandgaard
    Simon Guest

  6. #6

    Default Re: test::unit caller stack feature request

    On Feb 2, 2004, at 11:04, Simon Strandgaard wrote:
     
    >
    > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    > Ok I found my problem.
    > don't output the backtrace!
    > Solved
    >

    >
    >
    > Thanks for the help :-)[/ref]

    We all have those days... :-)


    Nathaniel

    <:((><



    Nathaniel Guest

Similar Threads

  1. Test::Unit non-auto-run test case?
    By Sean O'Dell in forum Ruby
    Replies: 1
    Last Post: September 18th, 06:19 PM
  2. Test::Unit -- multiple errors in test method ???
    By Johan Holmberg in forum Ruby
    Replies: 14
    Last Post: September 15th, 03:33 PM
  3. Method test::unit::TestSuite#<<(test)
    By Robert Klemme in forum Ruby
    Replies: 1
    Last Post: August 6th, 11:28 PM
  4. Test order in Test::Unit
    By Brian Candler in forum Ruby
    Replies: 0
    Last Post: July 5th, 08:58 PM
  5. Test::Unit GUI
    By Gour in forum Ruby
    Replies: 5
    Last Post: July 3rd, 04:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139