Sha256: 67df2682e16ac7e5f36aa1bca51a241297c4283cc5e027d18a9635e5d1a06ed9

Contents?: true

Size: 817 Bytes

Versions: 27

Compression:

Stored size: 817 Bytes

Contents

library(jsonlite)
library(testthat)
library(magrittr)

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 <- fromJSON(file.path("..", "config.json"))
  lapply(config$exercises$slug, test_exercise)
    
}

run_tests()

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
trackler-2.1.0.55 tracks/r/bin/run_tests.R
trackler-2.1.0.54 tracks/r/bin/run_tests.R
trackler-2.1.0.53 tracks/r/bin/run_tests.R
trackler-2.1.0.52 tracks/r/bin/run_tests.R
trackler-2.1.0.51 tracks/r/bin/run_tests.R
trackler-2.1.0.50 tracks/r/bin/run_tests.R
trackler-2.1.0.49 tracks/r/bin/run_tests.R