tests/testthat/test-destination-only.R

context('Destination-only codes')

test_that('Destination-only codes raise errors when used as origin', {
    f <- function(code) countrycode('x', origin = code, destination = 'iso3c')
    expect_error(f('currency'))
    expect_error(f('iso4217c'))
    expect_error(f('iso4217n'))
    expect_error(f('ar5'))
    expect_error(f('continent'))
    expect_error(f('cow.name'))
    expect_error(f('eu28'))
    expect_error(f('iso.name.en'))
    expect_error(f('cow.name'))
    expect_error(f('un.region.name'))
    expect_error(f('cldr.name.en'))
})

Try the countrycode package in your browser

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

countrycode documentation built on May 29, 2024, 4:44 a.m.