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.2.1.12 tracks/r/bin/run_tests.R
trackler-2.2.1.11 tracks/r/bin/run_tests.R
trackler-2.2.1.10 tracks/r/bin/run_tests.R
trackler-2.2.1.9 tracks/r/bin/run_tests.R
trackler-2.2.1.8 tracks/r/bin/run_tests.R
trackler-2.2.1.7 tracks/r/bin/run_tests.R
trackler-2.2.1.6 tracks/r/bin/run_tests.R
trackler-2.2.1.5 tracks/r/bin/run_tests.R
trackler-2.2.1.4 tracks/r/bin/run_tests.R
trackler-2.2.1.3 tracks/r/bin/run_tests.R
trackler-2.2.1.2 tracks/r/bin/run_tests.R
trackler-2.2.1.1 tracks/r/bin/run_tests.R
trackler-2.2.1.0 tracks/r/bin/run_tests.R
trackler-2.2.0.6 tracks/r/bin/run_tests.R
trackler-2.2.0.5 tracks/r/bin/run_tests.R
trackler-2.2.0.4 tracks/r/bin/run_tests.R
trackler-2.2.0.3 tracks/r/bin/run_tests.R
trackler-2.2.0.2 tracks/r/bin/run_tests.R
trackler-2.2.0.1 tracks/r/bin/run_tests.R
trackler-2.2.0.0 tracks/r/bin/run_tests.R