Skip to content

Commit

Permalink
add tests for .mime_cmd()
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Oct 2, 2024
1 parent 021b3bd commit 45a01c5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test-ci/test-base64.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
library(testit)

assert('.mime_cmd() works', {
# test some common file types
fs = list.files(R.home('doc'), '[.](html|pdf|png)$', recursive = TRUE, full.names = TRUE)
fs = fs[!duplicated(file_ext(fs))]
m = list(html = 'text/html', pdf = 'application/pdf', png = 'image/png')
(lapply(fs, .mime_cmd) %==% unname(m[file_ext(fs)]))
})

0 comments on commit 45a01c5

Please sign in to comment.