tests/testit/test-utils.R

library(testit)

assert('escape_latex() sanitizes backslashes and {}', {
  (escape_latex('\\') %==% '\\textbackslash{}')
  (escape_latex('\\{}') %==% '\\textbackslash{}\\{\\}')
  (escape_latex('{\\}') %==% '\\{\\textbackslash{}\\}')
  (escape_latex('~!@#$%^&*()') %==% '~!@#$%^&*()')
})

assert('escape_html() escapes HTML chars', {
  (escape_html('&"<>') %==% '&amp;&quot;&lt;&gt;')
  (escape_html('~!@#$%^&*()') %==% '~!@#$%^&amp;*()')
})

Try the highr package in your browser

Any scripts or data that you put into this service are public.

highr documentation built on June 22, 2024, 12:02 p.m.