---
title: "dev_history.Rmd empty"
output: html_document
editor_options: 
  chunk_output_type: console
---

```{r development, include=FALSE}
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

```{r function-real_name1}
#' fake_name1
#' @export
real_name1 <-
  function(x){
  x + 1
}
```
  
```{r example-real_name1}
real_name1(1)
```
  
```{r tests-real_name1}
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

```{r function-real_name2}
#' fake_name2

# a comment
real_name2 <- 
  function(x){
  x + 2
}
```

```{r example-real_name2}
real_name2(2)
```
  
```{r tests-real_name2}
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

```{r function-real_name3}
#' fake_name3
#' @noRd
real_name3 <- # a comment
  function(x){
  x + 3
}
```

```{r example-real_name3}
real_name3(3)
```
  
```{r tests-real_name3}
test_that("real_name3 works", {
  expect_true(inherits(real_name3, "function")) 
})
```

## commented line between name and linebreak

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

## linebreak, nothing before

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

## linebreak, roxygen before, symbol "="

```{r function-real_name6}
real_name6 = 
  function(x){
  x + 6
}
```

# No linebreak between name and function

## no linebreak, comment before

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

## no linebreak, code before

```{r function-real_name8}
sqrt(1)

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

## no linebreak, nothing before

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

## Multiple lines for details to detect example position

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

```{r example-real_name10}
real_name10(2)
```

## Two functions in the same chunck and line breaks

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

sub_real2 <- function(z) {z * 2}
```
  
```{r example-real_name11}
real_name11(1)
```
  
```{r tests-real_name11}
test_that("real_name11 works", {
  expect_true(inherits(real_name11, "function")) 
})
```

```{r development-1, eval=FALSE}
# Run but keep eval=FALSE to avoid infinite loop
# Execute in the console directly
fusen::inflate(flat_file = "dev/dev_history.Rmd")
```
