Skip to content

Commit

Permalink
Test piping ini
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Dec 5, 2023
1 parent 7b1adc2 commit 819476d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/testthat/test-piping-ini.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ test_that("piping with ini can update labels (rxode2/issues#351)", {
expect_equal(newLabelUi$iniDf$label[newLabelUi$iniDf$name == "a"], "bar")
})

test_that("piping with ini can remove labels (#627)", {

mod <- function() {
ini({
a <- 1
label("foo")
addSd <- 2
})
model({
b <- a
b ~ add(addSd)
})
}
ui <- rxode2(mod)
expect_equal(ui$iniDf$label[ui$iniDf$name == "a"], "foo")
newLabelUi <- ini(ui, a = label(NULL))
expect_equal(ui$iniDf$label[ui$iniDf$name == "a"], NA_character_)
})

test_that("piping with ini gives an error pointing the user to use label for character rhs (rxode2/issues#351)", {
mod <- function() {
ini({
Expand Down

0 comments on commit 819476d

Please sign in to comment.