Skip to content

Commit

Permalink
read.neurons warns about about missing files
Browse files Browse the repository at this point in the history
* closes #386
  • Loading branch information
jefferis committed Feb 6, 2019
1 parent 46cd754 commit f4af0b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/neuron-io.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ read.neurons<-function(paths, pattern=NULL, neuronnames=NULL, format=NULL,

if(!is.character(paths)) stop("Expects a character vector of filenames")

if(length(paths)==1 && file.info(paths)$isdir)
if(length(paths)==1 && isTRUE(file.info(paths)$isdir))
paths=dir(paths,pattern=pattern,full.names=TRUE)

if(is.function(neuronnames))
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-neuron-io.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ test_that("we can read in neurons as a neuronlist",{
regexp = 'While reading file.*Neurites\\.am')
})

test_that('we can deal with bad input to read.neurons', {
# by definition tempfile() doesn't exist
expect_warning(read.neurons(tempfile()), regexp = "No such file or directory")
})

test_that("we can read hxlineset format neurons",{

ebt7=structure(list(NeuronName = "EBT7R", InputFileName = "testdata/neuron/EBT7R.am",
Expand Down

0 comments on commit f4af0b1

Please sign in to comment.