tests/testthat/test_215_expr_unary_op.R

testthat::context("ExprUnaryOp class")

testthat::test_that("Initializer works fine", {
  testthat::expect_error(ExprUnaryOp$new())
  testthat::expect_error(ExprUnaryOp$new("not"))
  ExprUnaryOp$new("not", ExprField$new("flag"))
})

testthat::test_that("Conversion to string works fine", {
  x <- ExprUnaryOp$new("not", ExprField$new("flag"))
  testthat::expect_equal(x$toString(), "(NOT flag)")
  x$enableParenthesis(FALSE)
  testthat::expect_equal(x$toString(), "NOT flag")

  x <- ExprUnaryOp$new("-", ExprValue$new(12L))
  testthat::expect_equal(x$toString(), "(- 12)")
})

Try the sqlq package in your browser

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

sqlq documentation built on Sept. 16, 2025, 9:10 a.m.