blob: 197424b4fbe4ee67fa3a1b5ac703049c6409b985 [file] [log] [blame]
Marc Kupietz8cc6fd62021-03-05 10:49:48 +01001test_that("queryStringToLabel works correctly", {
2 expect_equivalent(queryStringToLabel(
3 c(
4 "referTo=x & textClass = /natur.*/ & creationDate in 2013",
5 "referTo=x & textClass = /natur.*/ & creationDate in 2014"
6 )
7 ),
8 c("2013", "2014"))
9
10 expect_equivalent(queryStringToLabel(
11 c(
12 "referTo=x & textClass = /natur.*/ & pubDate in 2013",
13 "referTo=x & textClass = /freizeit.*/ & pubDate in 2014"
14 ), pubDateOnly = T
15 ),
16 c("2013", "2014"))
17
18 expect_equivalent(queryStringToLabel(
19 c(
20 "referTo=x & textClass = /natur.*/ & creationDate in 2013",
21 "referTo=x & textClass = /freizeit.*/ & creationDate in 2014"
22 ), pubDateOnly = T
23 ),
24 c("2013", "2014"))
25
26 expect_equivalent(queryStringToLabel(
27 c(
28 "referTo=x & textClass = /natur.*/ & creationDate in 2013",
29 "referTo=x & textClass = /freizeit.*/ & creationDate in 2014"
30 ), excludePubDate = T
31 ),
32 c("/natur.*/", "/freizeit.*/"))
33})