Fix edge case with nested choices. Fixes #560

When the set of choices is a list containing a named vector of length 1,
choicesWithNames would return the wrong result.
This commit is contained in:
Winston Chang
2014-08-01 16:11:51 -05:00
parent 3aa22127e0
commit 21fb7959a5
2 changed files with 6 additions and 1 deletions

View File

@@ -76,6 +76,11 @@ test_that("Choices are correctly assigned names", {
choicesWithNames(list(A="a", B="b", C=list("d", "e"))),
list(A="a", B="b", C=list(d="d", e="e"))
)
# List, named, with a named sub-vector of length 1
expect_identical(
choicesWithNames(list(A="a", B="b", C=c(D="d"))),
list(A="a", B="b", C=list(D="d"))
)
# List, some named, with sublist
expect_identical(
choicesWithNames(list(A="a", "b", C=list("d", E="e"))),