Skip to content

Commit

Permalink
Add tests for nested query strings
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Aug 28, 2014
1 parent 2d3dd7d commit 5012831
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions inst/tests/test-url.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,26 @@ test_that("Query string parsing", {

# Should be the same with or without leading question mark
expect_identical(parseQueryString("?foo=1&bar=b"), parseQueryString("foo=1&bar=b"))


# Nested and non-nested query strings
expect_identical(
parseQueryString("a[i1][j1]=x&b[i1][j1]=y&b[i2][j1]=z"),
list(
"a[i1][j1]" = "x",
"b[i1][j1]" = "y",
"b[i2][j1]" = "z"
)
)

expect_identical(
parseQueryString("a[i1][j1]=x&b[i1][j1]=y&b[i2][j1]=z", nested = TRUE),
list(
a = list(i1 = list(j1 = "x")),
b = list(
i1 = list(j1 = "y"),
i2 = list(j1 = "z")
)
)
)
})

0 comments on commit 5012831

Please sign in to comment.