Sha256: 63bb2abbd7e244824d78e010b9a3e0f853f2e946ab36972bd7aebb60d96b3762

Contents?: true

Size: 773 Bytes

Versions: 166

Compression:

Stored size: 773 Bytes

Contents

test_exercise <- function(exercise) {
  
  solution_file <- paste0(exercise, ".R")
  test_file <- paste0("test_", exercise, ".R")
  
  file.copy(
    file.path("..", "exercises", exercise, "example.R"), 
    solution_file
  )
  file.copy(
    file.path("..", "exercises", exercise, test_file), 
    test_file
  )
  
  source(test_file)
  rm(list = ls())
  
}

run_tests <- function() {

  # create temp directory for testing purposes
  temp_dir <- "temp" 
  dir.create(temp_dir)
  setwd(temp_dir)
  
  on.exit({
    # clean up on exit
    setwd(dir = "../")
    unlink("temp", recursive = TRUE)
  })
  
  # read config and test all exercises
  config <- jsonlite::fromJSON(file.path("..", "config.json"))
  lapply(config$exercises$slug, test_exercise)
    
}

run_tests()

Version data entries

166 entries across 166 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/r/bin/run_tests.R
trackler-2.2.1.179 tracks/r/bin/run_tests.R
trackler-2.2.1.178 tracks/r/bin/run_tests.R
trackler-2.2.1.177 tracks/r/bin/run_tests.R
trackler-2.2.1.176 tracks/r/bin/run_tests.R
trackler-2.2.1.175 tracks/r/bin/run_tests.R
trackler-2.2.1.174 tracks/r/bin/run_tests.R
trackler-2.2.1.173 tracks/r/bin/run_tests.R
trackler-2.2.1.172 tracks/r/bin/run_tests.R
trackler-2.2.1.171 tracks/r/bin/run_tests.R
trackler-2.2.1.170 tracks/r/bin/run_tests.R
trackler-2.2.1.169 tracks/r/bin/run_tests.R
trackler-2.2.1.167 tracks/r/bin/run_tests.R
trackler-2.2.1.166 tracks/r/bin/run_tests.R
trackler-2.2.1.165 tracks/r/bin/run_tests.R
trackler-2.2.1.164 tracks/r/bin/run_tests.R
trackler-2.2.1.163 tracks/r/bin/run_tests.R
trackler-2.2.1.162 tracks/r/bin/run_tests.R
trackler-2.2.1.161 tracks/r/bin/run_tests.R
trackler-2.2.1.160 tracks/r/bin/run_tests.R