diff --git a/R/loadConfig.R b/R/loadConfig.R index 23036791..9767ac5c 100644 --- a/R/loadConfig.R +++ b/R/loadConfig.R @@ -142,7 +142,13 @@ expandPath = function(path) { if (length(parts) < 2) { return(parts) } if (identical(".", parts[1])) { parts = parts[2:length(parts)] } - # Expand any environment variables and return the complete path. + # Expand any environment variables and return the complete path + if(.Platform$OS.type=="unix") { + # Prevent double slashes + if(any(parts=="/")){ + parts[which(parts=="/")]="" + } + } fullPath = do.call(file.path, lapply(parts, expand)) return(fullPath) } diff --git a/tests/testthat/test_utils.R b/tests/testthat/test_utils.R new file mode 100644 index 00000000..df99dbc0 --- /dev/null +++ b/tests/testthat/test_utils.R @@ -0,0 +1,13 @@ +context("Utils") + +DF=mtcars +newDF=listifyDF(DF) + +test_that("listifyDF is a yields correct object type", { + expect_is(listifyDF(DF = DF),'data.frame') + expect_is(listifyDF(DF = DF)[[1]],'list') +}) + +test_that("listifyDF does not change the dimensions",{ + expect_equal(dim(listifyDF(DF)), dim(DF)) +}) \ No newline at end of file