Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/custom/after-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ runs:
fi
shell: bash

# Every impl's tests sit in test-aaa-<category>.R, mirroring the
# R/aaa-<category>.R that defines the impl
# (handbook/testing/suite/). Fails when a rerun would move a test.
- name: Check that impl tests sit in their category's file
run: Rscript tools/split-aaa-tests.R --check
shell: bash

# The roclet that links the C manual from the reference pages, named in
# DESCRIPTION's Roxygen field, is vendored in tools/igraph.r2cdocs
# (handbook/architecture/r-layer/documentation/). Only the smoke test
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Config/comment/Needs/roxygen2: The roclet igraph.r2cdocs::docs_rd that
Config/Needs/website: here, readr, tibble, xmlparsedata, xml2
Config/testthat/edition: 3
Config/testthat/parallel: true
Config/testthat/start-first: aaa-auto, vs-es, scan, vs-operators, weakref,
Config/testthat/start-first: aaa-*, vs-es, scan, vs-operators, weakref,
watts.strogatz.game
Encoding: UTF-8
Roxygen: list(markdown = TRUE, roclets = c("collate", "namespace",
Expand Down
2 changes: 1 addition & 1 deletion handbook/architecture/r-layer/new-functions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ What a new exported function needs before it merges.
[`tools/AGENTS.md`](/tools/AGENTS.md) is the implementation guide.

A function exported from the C library is generated, never written by hand ([`stimulus/`](/handbook/architecture/stimulus/README.md)):
its `*_impl()` gets a test in `tests/testthat/test-aaa-auto.R`,
its `*_impl()` gets a test in `tests/testthat/test-aaa-<category>.R` ([the suite](/handbook/testing/suite/README.md)),
and a graph constructor prefers `GATTR` and `GATTR-PARAM` in the Stimulus definitions over assigning attributes by hand.
5 changes: 4 additions & 1 deletion handbook/testing/suite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
The testthat suite under `tests/testthat/`.

* A test file mirrors its source file: `R/name.R` is tested in `tests/testthat/test-name.R`.
* New functionality comes with tests; a new generated `*_impl()` gets one in `test-aaa-auto.R`.
* New functionality comes with tests; a new generated `*_impl()` gets one in `test-aaa-<category>.R`,
the file mirroring the `R/aaa-<category>.R` that defines it.
[`tools/split-aaa-tests.R`](/tools/split-aaa-tests.R) moves each impl's tests and snapshots to that file,
so rerun it after an impl changes category; CI runs it with `--check` and fails while a test sits elsewhere.
* `testthat::test_local(reporter = "check")` runs the suite, and `filter = "name"` one file of it;
`devtools::check()` is the final step before a change is done.

Expand Down
Loading
Loading