tests/testthat/test-expressionFromIds.R

test_that("expressionFromIds works", {
    expect_equal(
        expressionFromIds(c("transcript1.trs","transcript2.eaf")),
        "['transcript1.trs','transcript2.eaf'].includes(id)")
})
test_that("expressionFromIds works with negation", {
    expect_equal(
        expressionFromIds(c("transcript1.trs","transcript2.eaf"), not=TRUE),
        "!['transcript1.trs','transcript2.eaf'].includes(id)")
})
test_that("expressionFromIds works with IDs that contain quotes", {
    expect_equal(
        expressionFromIds(c("O'Sullivan.TextGrid","\"T\" Rex.slt")),
        "['O\\'Sullivan.TextGrid','\"T\" Rex.slt'].includes(id)")
})

Try the nzilbb.labbcat package in your browser

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

nzilbb.labbcat documentation built on July 26, 2023, 6:08 p.m.