Skip to content

Commit

Permalink
file missing in cras_write
Browse files Browse the repository at this point in the history
  • Loading branch information
jospueyo committed Apr 4, 2023
1 parent 3356d19 commit abda7d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions R/cras_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' (from \code{template_create}) to a raw string following the CRediT authors
#' statement format of "author1: contributions author2: contributions ..."
#' @param cras_table A data.frame created using \code{create_template()}
#' @param file The text file to be created. If NULL (default), the statement is
#' @param file The text file to be created. If not provided (default), the statement is
#' returned as a string instead of written to a file.
#' @param drop_authors If TRUE (default) the authors without contributions are
#' removed from the statement. If FALSE, they are kept without contributions
Expand Down Expand Up @@ -38,7 +38,7 @@


cras_write <- function(cras_table,
file = NULL,
file,
drop_authors = TRUE,
overwrite = FALSE,
markdown = TRUE,
Expand Down Expand Up @@ -75,7 +75,7 @@ cras_write <- function(cras_table,

cras <- gsub(" $", "", cras)

if(is.null(file)){
if(missing(file)){
return(cras)
}

Expand Down
4 changes: 2 additions & 2 deletions man/cras_write.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-cras_write.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ test_that("authors are not dropped when drop_authors is false", {
expect_gt(grep("HIJ", cras_write(cras_table, drop_authors = FALSE)), 0)
})

test_that("cras_write returns vector when file is null",{
expect_equal(cras_write(cras_table, file = NULL, quiet = TRUE,), cras_md)
test_that("cras_write returns vector when file is missing",{
expect_equal(cras_write(cras_table, quiet = TRUE,), cras_md)
})

test_that("do not overwrite the file", {
Expand Down

0 comments on commit abda7d7

Please sign in to comment.