in reply to Get the number of the current test when debugging a test script

You want a conditional break point. From "perldebug":

b [line] [condition]

Set a breakpoint before the given line. If a condition is specified, it's evaluated each time the statement is reached: a breakpoint is taken only if the condition is true. Breakpoints may only be set on lines that begin an executable statement. Conditions don't use if:

b 237 $x > 30 b 237 ++$count237 < 11 b 33 /pattern/i

If the line number is ., sets a breakpoint on the current line:

b . $n > 100

Replies are listed 'Best First'.
Re^2: Get the number of the current test when debugging a test script
by Dumu (Monk) on Jun 30, 2015 at 16:29 UTC

    Yes, but I don't "know" which line to put it on. I don't want to have to trawl through the code manually counting my tests to find which one the test fails after.

    I was disappointed to find that you can't have a conditional watch, actually (e.g. watch for when $var == 3).

    Update

    removed misconception thanks to RonW

    To watch for a variable reaching a certain value, you need

    w (3 == var)

    or just

    w var == 3

      Based on the description in "perdebug":

      w expr

      Add a global watch-expression. Whenever a watched global changes the debugger will stop and display the old and new values.

      I would expect w (3 == $var) to do what you are asking for.

        Aha! Thanks RonW, I didn't quite get that. I just need the expr to return true. Spot on.