ruby / ruby/rbs

[test] Test coverage

Open
#180 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.2k
Forks
256
Avg merge
6d 17h
Merged PRs (30d)
37

Description

There is no way to measure how well the tests cover the method call variations.

Assume we have a method definition like:

def foo: (Integer | String) -> (Symbol | Array[String])
       | (Integer, String) -> void

We may write a test for the method like:

def test_foo
  foo(1)
  foo(1, "3)
end

It covers part of the first overload and second overload, but we need more cases to cover all of the variations.

def test_foo
  foo(1)              # Assume this returns Symbol
  foo("foo")          # Assume this returns Symbol
  foo(3)              # Assume this returns Array[String]
  foo(1, "3)
end

So, having a tool to measure the coverage would help writing tests.

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.

Research direction

Start from the overload examples in the issue and determine how method-call and return-type variations should be represented for coverage. Define what the tool should measure across the listed overloads and what output would show that all variations are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.