r-transit / gtfsio

Read and Write General Transit Feed Specification (GTFS)
https://r-transit.github.io/gtfsio/
Other
13 stars 3 forks source link

add tests to import_gtfs fun using testthat #5

Closed rafapereirabr closed 3 years ago

rafapereirabr commented 3 years ago

Here is the coverage resulf with the added tests. The warning below is realted to issue #4

library(covr)
library(testthat)
function_coverage(fun=gtfsio::import_gtfs, test_file("tests/testthat/test_import_gtfs.R"))

== Testing test_import_gtfs.R ==================================================
[ FAIL 0 | WARN 1 | SKIP 0 | PASS 8 ]

-- Warning (test_import_gtfs.R:32:3): import_gtfs errors and messages ---------------------
The provided GTFS feed doesn't contain the following text file(s): 'aaa'
Backtrace:
 1. testthat::expect_error(import_gtfs(path = gtfszip, files = "aaa")) test_import_gtfs.R:32:2
 6. gtfsio::import_gtfs(path = gtfszip, files = "aaa")

[ FAIL 0 | WARN 1 | SKIP 0 | PASS 8 ]
Coverage: 90.38%
R:/Dropbox/git/gtfsio/R/import_gtfs.R: 90.38%
dhersz commented 3 years ago

Hi Rafa. I decided using {tinytest} instead of {testthat} here. The former is lighter dependency-wise, but it provides pretty similar features overall. It also seemed a good opportunity (and excuse :P) to learn a new test suite.

I hope you don't mind.

Still, if you wanna contribute with some tests, you can place those in inst/tinytest (check the existing tests over there to have a grasp on syntax). Thanks!