Skip to content

Commit

Permalink
Merge branch 'development' into vignettes/chi-operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Moohan authored Sep 13, 2023
2 parents fa3f300 + fd51540 commit 0df2988
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
File renamed without changes.
28 changes: 28 additions & 0 deletions tests/testthat/_snaps/windows/file_size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Output is identical over time

Code
file_size(test_path("files"))
Output
# A tibble: 8 x 2
name size
<chr> <chr>
1 airquality.xls Excel 26 kB
2 bod.xlsx Excel 5 kB
3 iris.csv CSV 4 kB
4 mtcars.sav SPSS 4 kB
5 plant-growth.rds RDS 316 B
6 puromycin.txt Text 442 B
7 stackloss.fst FST 897 B
8 swiss.tsv TSV 1 kB

---

Code
file_size(test_path("files"), "xlsx?")
Output
# A tibble: 2 x 2
name size
<chr> <chr>
1 airquality.xls Excel 26 kB
2 bod.xlsx Excel 5 kB

13 changes: 10 additions & 3 deletions tests/testthat/test-file_size.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ test_that("Returns sizes in alphabetical order", {
})

test_that("Output is identical over time", {
expect_snapshot(file_size(test_path("files")))
expect_snapshot(file_size(test_path("files"), "xlsx?"))
# Text files report as larger on Windows so snapshot per OS
os <- ifelse(
"windows" %in% tolower(Sys.info()[["sysname"]]),
"windows",
"UNIX"
)

expect_snapshot(file_size(test_path("files")), variant = os)
expect_snapshot(file_size(test_path("files"), "xlsx?"), variant = os)
})

test_that("Errors if supplied with invalid filepath", {
expect_error(file_size(here::here("reference_files")))
expect_error(file_size(test_path("reference_files")))
expect_error(file_size(NA))
expect_error(file_size(NULL))
})
Expand Down

0 comments on commit 0df2988

Please sign in to comment.