test() should error on uncaught output

Open
#7,847 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
r
Domain
testing-qa

Research direction

Start by reproducing the two examples in the issue and locating the implementation of test(), then trace how it handles uncaught warnings and messages. Done means uncaught cat() output causes an error while the existing warning and message checks continue to behave as shown.

Written by the indexing model from the issue text.

Description

beginner-task tests
test(1, { cat("123\n"); TRUE })
# 123

That should error IMO, much as we error for uncaught warnings/messages:

test(1, { message("123\n"); TRUE })
Test 1 produced 1 messages but expected 0
Expected: 
Observed: 123

This will help keep the test log clean and is also a best practice IMO.

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

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 Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.