Nothing
y
y
y
y
Code
f()
Output
[1] "1"
Message
2
Condition
Warning in `f()`:
3
Error in `f()`:
! 4
Code
f()
Output
1
Message
2
Condition
Warning in `f()`:
3
Error in `f()`:
! 4
Code
x <- 1
y <- 1
{
message("a")
message("b")
}
Message
a
b
Code
{
warning("a")
warning("b")
}
Condition
Warning:
a
Warning:
b
Code
secret()
Output
[1] "<redacted>"
Message
<redacted>
Condition
Warning in `<redacted>()`:
<redacted>
Error in `<redacted>()`:
! <redacted>
Code
print("secret")
Output
[1] "****"
This is an error
This is a warning
Code
foo()
Condition
Warning:
`foo()` was deprecated in testthat 1.0.0.
`foo()` was deprecated in testthat 1.0.0.
`foo()` was deprecated in testthat 1.0.0.
Code
expect_snapshot_error(1)
Condition
Error:
! 1 did not generate error
Code
expect_snapshot_error(1, class = "myerror")
Condition
Error:
! 1 did not generate error with class 'myerror'
Code
expect_snapshot_warning(1)
Condition
Error:
! 1 did not generate warning
Code
expect_snapshot_warning(1, class = "mywarning")
Condition
Error:
! 1 did not generate warning with class 'mywarning'
Code
1 + 2
Output
[1] 3
Code
3 + 4
Output
[1] 7
Code
# this is a comment
Code
f_visible()
Output
[1] "x"
Code
f_invisible()
Code
f()
Message
Hello
Condition
Warning:
Goodbye
Error in `f()`:
! Eeek!
a
b
c
a
b
c
[
"a",
1.5,
1,
true
]
{
"type": "list",
"attributes": {},
"value": [
{
"type": "character",
"attributes": {},
"value": ["a"]
},
{
"type": "double",
"attributes": {},
"value": [1.5]
},
{
"type": "integer",
"attributes": {},
"value": [1]
},
{
"type": "logical",
"attributes": {},
"value": [true]
}
]
}
list("a", 1.5, 1L, TRUE)
WAoAAAACAAMGAwACAwAAAAATAAAABAAAABAAAAABAAQACQAAAAFhAAAADgAAAAE/+AAAAAAA
AAAAAA0AAAABAAAAAQAAAAoAAAABAAAAAQ==
1.1
0.9
expect_snapshot()
does not injectCode
x <- quote(!!foo)
expect_equal(x, call("!", call("!", quote(foo))))
Code
cat(snapshot_accept_hint("_default", "bar.R", reset_output = FALSE))
Output
* Run ]8;;ide:run:testthat::snapshot_accept('bar.R')testthat::snapshot_accept('bar.R')]8;; to accept the change.
* Run ]8;;ide:run:testthat::snapshot_review('bar.R')testthat::snapshot_review('bar.R')]8;; to interactively review the change.
Code
cat(snapshot_accept_hint("foo", "bar.R", reset_output = FALSE))
Output
* Run ]8;;ide:run:testthat::snapshot_accept('foo/bar.R')testthat::snapshot_accept('foo/bar.R')]8;; to accept the change.
* Run ]8;;ide:run:testthat::snapshot_review('foo/bar.R')testthat::snapshot_review('foo/bar.R')]8;; to interactively review the change.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.