dev_history.Rmd empty

library(testthat)

linebreak between name and function

linebreak, roxygen before

to be checked: function name, no example in .R, 1 .Rd, 1 example in .Rd, 1 test

#' fake_name1
#' @export
real_name1 <-
  function(x){
  x + 1
}
real_name1(1)
test_that("real_name1 works", {
  expect_true(inherits(real_name1, "function")) 
})

linebreak, comment before

to be checked: function name, 1 example in .R, no .Rd, 1 test

#' fake_name2

# a comment
real_name2 <- 
  function(x){
  x + 2
}
real_name2(2)
test_that("real_name2 works", {
  expect_true(inherits(real_name2, "function")) 
})

comment between name and linebreak

to be checked: function name, 1 example in .R, no .Rd, 1 test

#' fake_name3
#' @noRd
real_name3 <- # a comment
  function(x){
  x + 3
}
real_name3(3)
test_that("real_name3 works", {
  expect_true(inherits(real_name3, "function")) 
})

commented line between name and linebreak

#' fake_name4
real_name4 <- 
# a comment
  function(x){
  x + 4
}

linebreak, nothing before

real_name5 <- 
  function(x){
  x + 5
}

linebreak, roxygen before, symbol "="

real_name6 = 
  function(x){
  x + 6
}

No linebreak between name and function

no linebreak, comment before

#' fake_name7
# a comment
real_name7 <- function(x){
  x + 7
}

no linebreak, code before

sqrt(1)

#' Real name 8
real_name8 <- function(x){
  x + 8
}

no linebreak, nothing before

real_name9 <- function(x){
  x + 9
}

Multiple lines for details to detect example position

#' fakename10
#' 
#' @param x x
#' @export
#' @details 
#' Multiple lines for
#' details
real_name10 <- function(x){
  x + 9
}
real_name10(2)

Two functions in the same chunck and line breaks

#' real_name11
#' @export
real_name11 <-
  function(x) {
    sub_real <- function(y) {y + 2}
    sub_real(x) + 1
  }

sub_real2 <- function(z) {z * 2}
real_name11(1)
test_that("real_name11 works", {
  expect_true(inherits(real_name11, "function")) 
})
# Run but keep eval=FALSE to avoid infinite loop
# Execute in the console directly
fusen::inflate(flat_file = "dev/dev_history.Rmd")


Try the fusen package in your browser

Any scripts or data that you put into this service are public.

fusen documentation built on Aug. 17, 2023, 5:09 p.m.