Debian Codegraph @

tests/test-ci/test-base64.R

raw
1 library(testit)
2
3 assert('.mime_cmd() works', {
4 # test some common file types
5 fs = list.files(R.home('doc'), '[.](html|pdf|png)$', recursive = TRUE, full.names = TRUE)
6 fs = fs[!duplicated(file_ext(fs))]
7 m = list(html = 'text/html', pdf = 'application/pdf', png = 'image/png')
8 types = unname(m[file_ext(fs)])
9 (lapply(fs, .mime_cmd) %==% types)
10 (!is_windows() || lapply(fs, .mime_cmd, use_file = FALSE) %==% types)
11 })