assert_is_connection(stdin())
tcon <- textConnection("txt", "w", local = TRUE)
assert_is_open_connection(tcon)
cat("this has no final newline character", file = tcon)
assert_is_incomplete_connection(tcon)
close(tcon)
#These examples should fail.
assert_is_connection("not a connection")
fcon <- file()
close(fcon)
assert_is_open_connection(fcon)
Run the code above in your browser using DataLab