It seems that there is a regression in expect_message() as it now only captures the first message produced by the tested call: 220c8bf#diff-db01a1b7dcaea272eccac3b208c64a64R481.
As can be seen from this reproducible example:
With tinytest version 1.1.0 - works as expected (captures both messages):
docker run --rm -it r-base Rscript -e " \
download.file('https://cran.r-project.org/src/contrib/Archive/tinytest/tinytest_1.1.0.tar.gz', destfile = 'tinytest_1.1.0.tar.gz')
install.packages('tinytest_1.1.0.tar.gz', repos = NULL)
foo <- function() { message('one'); message('two'); 1 };
tinytest::expect_message(foo(), 'one')
tinytest::expect_message(foo(), 'two')
"
relevant output:
----- PASSED : <-->
call| tinytest::expect_message(foo(), "one")
----- PASSED : <-->
call| tinytest::expect_message(foo(), "two")
Whereas with tinytest 1.2.0 (captures only the first message):
docker run --rm -it r-base Rscript -e " \
download.file('https://cran.r-project.org/src/contrib/tinytest_1.2.0.tar.gz', destfile = 'tinytest_1.2.0.tar.gz')
install.packages('tinytest_1.2.0.tar.gz', repos = NULL)
foo <- function() { message('one'); message('two'); 1 };
tinytest::expect_message(foo(), 'one')
tinytest::expect_message(foo(), 'two')
"
relevant output:
----- PASSED : <-->
call| tinytest::expect_message(foo(), "one")
----- FAILED[xcpt]: <-->
call| tinytest::expect_message(foo(), "two")
diff| The message message
diff| 'one
diff| '
diff| does not match pattern 'two'
It seems that there is a regression in
expect_message()as it now only captures the first message produced by the tested call: 220c8bf#diff-db01a1b7dcaea272eccac3b208c64a64R481.As can be seen from this reproducible example:
With tinytest version 1.1.0 - works as expected (captures both messages):
relevant output:
Whereas with tinytest 1.2.0 (captures only the first message):
relevant output: