Skip to content

Commit

Permalink
Name the shell script correctly (with or without '.sh')
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Eagles committed Oct 4, 2023
1 parent 136439f commit d488754
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/testthat/test-array_submit.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
script_name <- "my_array_job.sh"
script_name <- "my_array_job"

# Write a basic shell script with 'job_single()'
basic_job <- function() {
with_wd(
tempdir(),
{
# Delete the shell script if it exists
unlink(script_name)
unlink(paste0(script_name, ".sh"))

job_single(
name = script_name,
Expand All @@ -25,9 +25,9 @@ broken_job <- function() {
{
basic_job()

orig_script <- readLines(script_name)
orig_script <- readLines(paste0(script_name, ".sh"))
orig_script <- sub("^#SBATCH", "something", orig_script)
writeLines(orig_script, script_name)
writeLines(orig_script, paste0(script_name, ".sh"))
}
)
}
Expand All @@ -41,14 +41,14 @@ run_test <- function(shell_creation_fun, ...) {
{
shell_creation_fun()

original <- readLines(script_name)
original <- readLines(paste0(script_name, ".sh"))

array_submit(
job_bash = script_name,
job_bash = paste0(script_name, ".sh"),
...
)

final <- readLines(script_name)
final <- readLines(paste0(script_name, ".sh"))
return(NULL)
}
)
Expand Down

0 comments on commit d488754

Please sign in to comment.