@@ -1373,6 +1373,16 @@ test_that("static rendering", {
13731373 skip(" V8 was built against a version of libv8 without i18n support" )
13741374 })
13751375
1376+ # Some distros like Debian build V8 with full ICU / i18n support, rather than the typical minimal ICU that includes
1377+ # the en locale only. In this case, Intl will exist and locales besides en will be supported. We need to know whether
1378+ # full ICU support is available for testing on platforms like CRAN's Debian machines.
1379+ v8_has_full_icu_support <- tryCatch({
1380+ V8 :: new_context()$ eval(" Intl" )
1381+ TRUE
1382+ }, error = function (e ) {
1383+ FALSE
1384+ })
1385+
13761386 data <- data.frame (
13771387 x = c(1 , 2 ),
13781388 y = c(" a" , " column-y-cell" ),
@@ -1497,7 +1507,7 @@ test_that("static rendering", {
14971507 date = colDef(format = colFormat(datetime = TRUE , prefix = " _date_" , suffix = " _date_" )),
14981508 time = colDef(format = colFormat(time = TRUE , prefix = " _time_" , suffix = " _time_" )),
14991509 num = colDef(format = colFormat(digits = 1 , separators = TRUE )),
1500- # Current limitation: locales other than "en" aren't supported for now
1510+ # Current limitation: in most V8 builds, locales other than "en" aren't supported for now
15011511 locale_hi_IN = colDef(format = colFormat(locales = " hi-IN" , currency = " INR" , separators = TRUE ))
15021512 ),
15031513 static = TRUE ,
@@ -1511,7 +1521,14 @@ test_that("static rendering", {
15111521 expect_match(html , " >$10.00<" , fixed = TRUE )
15121522 expect_match(html , " >€11.12<" , fixed = TRUE )
15131523 expect_match(html , " >1,234.1<" , fixed = TRUE )
1514- expect_match(html , " >₹1,234,567.40<" , fixed = TRUE )
1524+ if (v8_has_full_icu_support ) {
1525+ expect_match(html , " >₹12,34,567.40<" , fixed = TRUE )
1526+ html <- sub(" >₹12,34,567.40<" , " >replaced<" , html )
1527+ } else {
1528+ # en locale fallback
1529+ expect_match(html , " >₹1,234,567.40<" , fixed = TRUE )
1530+ html <- sub(" >₹1,234,567.40<" , " >replaced<" , html )
1531+ }
15151532 # Date/time formatting depends on the local timezone, which can't easily be controlled in tests
15161533 expect_no_match(html , " _date_2019-05-06T03:22:15Z_date_" , fixed = TRUE )
15171534 html <- sub(" >_date_.+_date_<" , " >_date_replaced_date_<" , html )
0 commit comments