test code notation with break

Open
#557 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby

Research direction

Start by reviewing the existing debug_code test framework usage and the two proposed notations: comments on source lines or markers beside line numbers. Compare both with the existing break commands and debugger method, then define how tests should translate the chosen notation into breakpoints and how completion will be verified.

Written by the indexing model from the issue text.

Description

enhancement

Just idea.

Now we need to set breakpoints with break commands on tests like:

    def program
      <<~RUBY
       1| def foo a
       2|   b = a + 1  # break
       3| end
       4| x = 1        # break
       5| x = 2
       6| x = 3
      RUBY
    end

    def test_foobar
      debug_code program do
        type 'break 2'
        type 'break 4'

On this code, line 2 and 4 is breakpont, and using 2 break commands. On the other hands, if we use IDE we can set breakpoints on a code (with editor's support). So we can write breakpoints on the code.

IDEA1: Use comment on the line.

      <<~RUBY
       1| def foo a
       2|   b = a + 1  # break
       3| end
       4| x = 1        # break
       5| x = 2
       6| x = 3
      RUBY

and issues two break commands by the test framework.

IDEA2: Check on the left of line number:

      <<~RUBY
       1| def foo a
      *2|   b = a + 1
       3| end
      *4| x = 1
       5| x = 2
       6| x = 3
      RUBY

and issues two break commands by the test framework.


Of course we can write debugger method, but it can be different from normal break points, so it should be supported separately.

Dominant language
Ruby
Stars
1.3k
Forks
146
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ruby/debug

All issues in ruby/debug

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.