Skip to content

Commit 31b52ff

Browse files
committed
Test functions and documentation etc
1 parent e52082d commit 31b52ff

File tree

8 files changed

+93
-0
lines changed

8 files changed

+93
-0
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
^\.github$
2+
^.*\.Rproj$
3+
^\.Rproj\.user$

DESCRIPTION

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Package: TestPackage
2+
Type: Package
3+
Title: What the Package Does (Short Line)
4+
Version: 1.0
5+
Date: 2025-10-21
6+
Author: Who wrote it
7+
Maintainer: Who to complain to <yourfault@somewhere.net>
8+
Description: More about what it does (maybe more than one line).
9+
License: What license is it under?
10+
RoxygenNote: 7.3.3

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export(f)

R/f.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#' Test function
2+
#'
3+
#' @param x Test input
4+
#'
5+
#' @return Not much
6+
#'
7+
#' @export
8+
f <-
9+
function( x ){
10+
print( x^2 )
11+
}

man/TestPackage-package.Rd

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
\name{TestPackage-package}
2+
\alias{TestPackage-package}
3+
\alias{TestPackage}
4+
\docType{package}
5+
\title{
6+
\packageTitle{TestPackage}
7+
}
8+
\description{
9+
\packageDescription{TestPackage}
10+
}
11+
\details{
12+
%% ~~ An overview of how to use the package, ~~
13+
%% ~~ including the most important functions ~~
14+
}
15+
\author{
16+
\packageAuthor{TestPackage}
17+
18+
Maintainer: \packageMaintainer{TestPackage}
19+
}
20+
\references{
21+
%% ~~ Literature or other references for background information ~~
22+
}
23+
\keyword{package}
24+
25+
%% Uncomment below to imitate parts of library(help = TestPackage)
26+
%\section{The \file{DESCRIPTION} File}{\packageDESCRIPTION{TestPackage}}
27+
%\section{Documentation Index}{\packageIndices{TestPackage}}
28+
29+
\seealso{
30+
%% ~~ Optional links to other man pages, e.g. ~~
31+
%% ~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
32+
}
33+
\examples{
34+
%% ~~ Optional simple examples of the most important functions ~~
35+
}

man/f.Rd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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(TestPackage)
11+
12+
test_check("TestPackage")

tests/testthat/test-f.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test_that("test_test", {
2+
expect_equal( f( 2 ), 4)
3+
})

0 commit comments

Comments
 (0)