Skip to content

Commit d2862ad

Browse files
committed
add test for deprecated warning
1 parent dafa0d6 commit d2862ad

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/testthat/test-model-compile.R

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ if (not_on_cran()) {
66
mod <- cmdstan_model(stan_file = stan_program, compile = FALSE)
77
}
88

9-
109
test_that("object initialized correctly", {
1110
skip_on_cran()
1211
expect_equal(mod$stan_file(), stan_program)
@@ -399,4 +398,25 @@ test_that("check_syntax() works with include_paths", {
399398

400399
})
401400

401+
test_that("check_syntax() works with pedantic=TRUE", {
402+
skip_on_cran()
403+
model_code <- "
404+
transformed data {
405+
real a;
406+
a <- 3;
407+
}
408+
"
409+
stan_file <- write_stan_file(model_code)
410+
mod_dep_warning <- cmdstan_model(stan_file, compile = FALSE)
411+
expect_message(
412+
mod_dep_warning$compile(),
413+
"Warning: deprecated language construct used in",
414+
fixed = TRUE
415+
)
416+
expect_message(
417+
mod_dep_warning$check_syntax(),
418+
"Warning: deprecated language construct used in",
419+
fixed = TRUE
420+
)
421+
})
402422

0 commit comments

Comments
 (0)