-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hey @pmcharrison,
@KilianSander and I discovered some weird behaviour when using the magrittr pipe and calling new_timeline. Consider:
# Load the psychTestR package
library(psychTestR)
# Define a dictionary with a typo
my_dict <- i18n_dict$new(data.frame(key = "key1",
en = "Welcoom to the test!",
de = "Willkoommen zum Test")) # We also like typos
# Composing new_timline in the standard way => expected results
tl_good <- new_timeline(
list(final_page(i18n("key1"))),
dict = my_dict
)
# With some base R sugary syntax => expected results
tl_good2 <- list(final_page(i18n("key1"))) |>
new_timeline(dict = my_dict)
# With some magrittr sugary syntax => we have a problem
tl_bad <- list(final_page(i18n("key1"))) %>%
new_timeline(dict = my_dict)
make_test(tl_good,
opt = test_options(title = "Test",
admin_password = "hi",
languages = "de"))
The first two cases (tl_good, tl_good2) work when used as a call to make_test, but not the third (tl_bad). The magrittr pipe seems to break psychTestR's ability to do translations properly.
Indeed:
all.equal(tl_good, tl_good2)
TRUE
all.equal(tl_good, tl_bad)
FALSE
Internally in new_timeline, comparing how tl_good and tl_bad run, things seem to be the same, at least up until just before:
psychTestR::timeline$new(res)
is called. Or maybe it's to do with the finally block?
Or perhaps this is just a magrittr issue? In any case, just making you aware.
@klausfrieler You'll probably find this one fun.
All the best,
Seb
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels