-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-po_update.R
More file actions
51 lines (40 loc) · 1.19 KB
/
test-po_update.R
File metadata and controls
51 lines (40 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
test_that("user is told what's happening", {
temp <- local_test_package("R/test.r" = "message('Hello')")
withr::local_dir(temp)
po_extract()
po_create(c("ja", "fr"))
# verbose output for shell commands on Windows uses " in shQuote (vs ' on unix)
expect_snapshot(
po_update(verbose = TRUE, lazy = FALSE),
transform = standardise_dots,
variant = .Platform$OS.type
)
})
test_that("user is told what's happening", {
temp <- local_test_package("R/test.r" = "message('Hello')")
withr::local_dir(temp)
po_extract()
po_create("fr")
writeLines("message('Hi')", file.path(temp, "R/test.R"))
po_extract()
po_update()
expect_false(file.exists(file.path(temp, "po/R-fr.po~")))
})
test_that("lazy=TRUE, verbose=TRUE skips up-to-date files and messages", {
temp <- local_test_package("R/test.r" = "message('Hello')")
withr::local_dir(temp)
po_extract()
po_create("ja")
# run once to make sure it's "up-to-date"
po_update()
# Ensure mtime is different.
Sys.sleep(1.25)
expect_silent(
po_update(lazy = TRUE, verbose = FALSE)
)
expect_output(
po_update(lazy = TRUE, verbose = TRUE),
"Skipping 'ja' R translation (up-to-date)",
fixed = TRUE
)
})