Debian Codegraph @

tests/testit/test-tangle.R

raw
1 library(testit)
2
3 tangle_text = function(text, out.format = 'markdown') {
4 optk = opts_knit$get()
5 opts_knit$set(out.format = out.format)
6 on.exit(opts_knit$set(optk), add = TRUE)
7 purl(text = text)
8 }
9
10 # Test that when there is no pattern specified, no pattern found, and the file
11 # is tangled, purl() returns an empty string rather than the original text.
12 # https://github.com/yihui/knitr/pull/1660
13 assert('when LP pattern not found in the input, purl() returns an empty string', {
14 (tangle_text('There is no code.') %==% '')
15 })