tests/testthat/test-pd_if.R

#! This file was automatically produced by the testextra package.
#! Changes will be overwritten.

context('tests extracted from file `pd_if.R`')
#line 121 "R/pd_if.R"
test_that('if structures', {#!@testing if structures
    pd <- get_parse_data(parse(text={"
        if(predicate){
            body
        } else {
            alternate
        }
    "}, keep.source=TRUE))
    id <- roots(pd) # 33

    expect_true(pd_is_if(id,pd))
    expect_equal(pd_get_if_predicate_id(id, pd), parent(.find_text('predicate')))
    expect_equal(pd_get_if_branch_id   (id, pd), parent(parent(.find_text('body'))))
    expect_equal(pd_get_if_alternate_id(id, pd), parent(parent(.find_text('alternate'))))
})
RDocTaskForce/parsetools documentation built on April 10, 2020, 11:58 p.m.