File tree Expand file tree Collapse file tree 6 files changed +102
-0
lines changed
Expand file tree Collapse file tree 6 files changed +102
-0
lines changed Original file line number Diff line number Diff line change 11^LICENSE\.md$
2+ ^\.github$
Original file line number Diff line number Diff line change 1+ # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+ on :
4+ push :
5+ branches : [main, master]
6+ pull_request :
7+
8+ name : R-CMD-check.yaml
9+
10+ permissions : read-all
11+
12+ jobs :
13+ R-CMD-check :
14+ runs-on : ${{ matrix.config.os }}
15+
16+ name : ${{ matrix.config.os }} (${{ matrix.config.r }})
17+
18+ strategy :
19+ fail-fast : false
20+ matrix :
21+ config :
22+ - {os: macos-latest, r: 'release'}
23+ - {os: windows-latest, r: 'release'}
24+ - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
25+ - {os: ubuntu-latest, r: 'release'}
26+ - {os: ubuntu-latest, r: 'oldrel-1'}
27+
28+ env :
29+ GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
30+ R_KEEP_PKG_SOURCE : yes
31+
32+ steps :
33+ - uses : actions/checkout@v4
34+
35+ - uses : r-lib/actions/setup-pandoc@v2
36+
37+ - uses : r-lib/actions/setup-r@v2
38+ with :
39+ r-version : ${{ matrix.config.r }}
40+ http-user-agent : ${{ matrix.config.http-user-agent }}
41+ use-public-rspm : true
42+
43+ - uses : r-lib/actions/setup-r-dependencies@v2
44+ with :
45+ extra-packages : any::rcmdcheck
46+ needs : check
47+
48+ - uses : r-lib/actions/check-r-package@v2
49+ with :
50+ upload-snapshots : true
51+ build_args : ' c("--no-manual","--compact-vignettes=gs+qpdf")'
Original file line number Diff line number Diff line change @@ -10,3 +10,6 @@ License: MIT + file LICENSE
1010Encoding: UTF-8
1111Roxygen: list(markdown = TRUE)
1212RoxygenNote: 7.3.3
13+ Suggests:
14+ testthat (>= 3.0.0)
15+ Config/testthat/edition: 3
Original file line number Diff line number Diff line change 1+
2+ # rhds.rpackage
3+
4+ <!-- badges: start -->
5+ [ ![ R-CMD-check] ( https://github.com/MRCIEU/rhds.rpackage/actions/workflows/R-CMD-check.yaml/badge.svg )] ( https://github.com/MRCIEU/rhds.rpackage/actions/workflows/R-CMD-check.yaml )
6+ <!-- badges: end -->
7+
8+ Example package for the RHDS short course
9+
10+ ## Installation
11+
12+ You can install the development version of rhds.rpackage from [ GitHub] ( https://github.com/ ) with:
13+
14+ ``` r
15+ remotes :: install_github(" MRCIEU/rhds.rpackage" )
16+ ```
17+
Original file line number Diff line number Diff line change 1+ # This file is part of the standard setup for testthat.
2+ # It is recommended that you do not modify it.
3+ #
4+ # Where should you do additional test configuration?
5+ # Learn more about the roles of various files in:
6+ # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
7+ # * https://testthat.r-lib.org/articles/special-files.html
8+
9+ library(testthat )
10+ library(rhds.rpackage )
11+
12+ test_check(" rhds.rpackage" )
Original file line number Diff line number Diff line change 1+ library(testthat )
2+
3+ test_that(" extract.participant extracts participant ID correctly" , {
4+ # Test basic TCGA ID format
5+ expect_equal(extract.participant(" TCGA-AB-1234-01A" ), " 1234" )
6+
7+ # Test with different project code
8+ expect_equal(extract.participant(" TCGA-XY-5678-11B" ), " 5678" )
9+
10+ # Test with longer suffix
11+ expect_equal(extract.participant(" TCGA-CD-9999-01A-01D-1234-08" ), " 9999" )
12+
13+ # Test with minimal valid format
14+ expect_equal(extract.participant(" TCGA-AB-123-01" ), " 123" )
15+
16+ # Test that non-matching format returns original string
17+ expect_equal(extract.participant(" invalid-id" ), " invalid-id" )
18+ })
You can’t perform that action at this time.
0 commit comments