-
Notifications
You must be signed in to change notification settings - Fork 23
Create Testing chapter #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SaranjeetKaur
wants to merge
14
commits into
main
Choose a base branch
from
testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
292f665
Create testing_in_R.Rmd
SaranjeetKaur b8ea83f
Merge pull request #83 from r-devel/master
SaranjeetKaur 97a57f3
Update testing_in_R.Rmd
SaranjeetKaur fc68dd4
expand testing R chapter
SaranjeetKaur 386646b
minor edits
SaranjeetKaur 07d3071
Apply suggestions Heather's suggestions
SaranjeetKaur 29fc6b1
Update 08-testing_in_R.Rmd
SaranjeetKaur 03963e0
Merge branch 'main' into testing
SaranjeetKaur f6555db
fix typos
SaranjeetKaur aac9d07
fix formatting
SaranjeetKaur e85618c
add chapter to _quarto.yml
SaranjeetKaur 4d6344e
update quarto.yml
SaranjeetKaur 1abdd6a
fix yml conflicts
SaranjeetKaur 58199e5
move testing_in_r to chapters
SaranjeetKaur File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Testing in R | ||
|
||
This chapter discusses about writing tests for R and extending the test suite for R. Usually, when one contributes a patch, one might also want to contribute tests that are able to cover the new code. | ||
|
||
## When and why to write a test? | ||
|
||
Whenever you add new functions to R base or any of the packages distributed with R, it is beneficial to add test(s) corresponding to the new code. While doing so it is essential to check whether `make test-Specific` still works with the new code included. In particular, check whether `cd tests; make no-segfault.Rout` work on a standalone computer without the requirement of an interactive user intervention. | ||
|
||
If the new code requires GUI interaction or accesses the Internet, then it is essential to add its name to the `stop list` in `tests/no-segfault.Rin`. | ||
|
||
## Writing tests for R (adopted from the pre release test chapter, remove this section from there) | ||
|
||
Writing tests for R is much like writing tests for your own code. Tests need to be thorough, fast, isolated, consistently repeatable, and as simple as possible. | ||
|
||
When you are adding tests to an existing test file, it is also recommended that you study the other tests in that file; it will teach you which precautions you have to take to make your tests robust and portable. We try to have tests both for normal behaviour and for error conditions. Tests live in the `tests` directory. | ||
SaranjeetKaur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Benchmarks | ||
|
||
Benchmarking is useful to test that a change does not degrade performance. | ||
SaranjeetKaur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.