tests/testthat/test.lex_error1.R

#! /usr/bin/env Rscript

library(testthat)
library(rly)

context("Missing t_error() rule")

Lexer <- R6::R6Class("Lexer",
  public = list(
    tokens = c('NUMBER', 'PLUS','MINUS'),
    t_PLUS = '\\+',
    t_MINUS = '-',
    t_NUMBER = '\\d+'
  )
)

test_that("no t_error()", {
  expect_output(rly::lex(Lexer), "WARN .* No t_error rule is defined")
})
systemincloud/rly documentation built on May 11, 2022, 11:13 a.m.