@@ -68,109 +68,109 @@ describe('Search parser', function()
68
68
it (' should parse search term and match string properties and value' , function ()
69
69
local result = Search :new (' CATEGORY="test"&MYPROP=myval+WORK' )
70
70
assert .Is .True (result :check ({
71
- props = { CATEGORY = ' test' , MYPROP = ' myval' , AGE = 10 },
71
+ props = { category = ' test' , myprop = ' myval' , age = 10 },
72
72
tags = { ' WORK' , ' OFFICE' },
73
73
}))
74
74
75
75
assert .Is .False (result :check ({
76
- props = { CATEGORY = ' invalid' , MYPROP = ' myval' , AGE = 10 },
76
+ props = { category = ' invalid' , myprop = ' myval' , age = 10 },
77
77
tags = { ' WORK' , ' OFFICE' },
78
78
}))
79
79
80
80
assert .Is .False (result :check ({
81
- props = { CATEGORY = ' test' , MYPROP = ' myval' , AGE = 10 },
81
+ props = { category = ' test' , myprop = ' myval' , age = 10 },
82
82
tags = { ' OFFICE' },
83
83
}))
84
84
end )
85
85
86
86
it (' should parse search term and match number properties and value' , function ()
87
87
local result = Search :new (' PAGES>=1000&ITEMS<500&COUNT=10&CALCULATION<>5&BOOKS>3+WORK' )
88
88
assert .Is .True (result :check ({
89
- props = { PAGES = 1010 , ITEMS = 100 , COUNT = 10 , CALCULATION = 8 , BOOKS = 5 },
89
+ props = { pages = 1010 , items = 100 , count = 10 , calculation = 8 , books = 5 },
90
90
tags = { ' WORK' , ' OFFICE' },
91
91
}))
92
92
93
93
assert .Is .True (result :check ({
94
- props = { PAGES = 1000 , ITEMS = 499 , COUNT = 10 , CALCULATION = 10 , BOOKS = 4 },
94
+ props = { pages = 1000 , items = 499 , count = 10 , calculation = 10 , books = 4 },
95
95
tags = { ' WORK' },
96
96
}))
97
97
98
98
assert .Is .False (result :check ({
99
- props = { PAGES = 999 , ITEMS = 499 , COUNT = 10 , CALCULATION = 10 , BOOKS = 4 },
99
+ props = { pages = 999 , items = 499 , count = 10 , calculation = 10 , books = 4 },
100
100
tags = { ' WORK' },
101
101
}))
102
102
103
103
assert .Is .False (result :check ({
104
- props = { PAGES = 1001 , ITEMS = 500 , COUNT = 10 , CALCULATION = 10 , BOOKS = 4 },
104
+ props = { pages = 1001 , items = 500 , count = 10 , calculation = 10 , books = 4 },
105
105
tags = { ' WORK' },
106
106
}))
107
107
108
108
assert .Is .False (result :check ({
109
- props = { PAGES = 1001 , ITEMS = 500 , COUNT = 11 , CALCULATION = 10 , BOOKS = 4 },
109
+ props = { pages = 1001 , items = 500 , count = 11 , calculation = 10 , books = 4 },
110
110
tags = { ' WORK' },
111
111
}))
112
112
113
113
assert .Is .False (result :check ({
114
- props = { PAGES = 1001 , ITEMS = 500 , COUNT = 11 , CALCULATION = 5 , BOOKS = 4 },
114
+ props = { pages = 1001 , items = 500 , count = 11 , calculation = 5 , books = 4 },
115
115
tags = { ' WORK' },
116
116
}))
117
117
118
118
assert .Is .False (result :check ({
119
- props = { PAGES = 1001 , ITEMS = 500 , COUNT = 11 , CALCULATION = 5 , BOOKS = 3 },
119
+ props = { pages = 1001 , items = 500 , count = 11 , calculation = 5 , books = 3 },
120
120
tags = { ' WORK' },
121
121
}))
122
122
123
123
assert .Is .False (result :check ({
124
- props = { PAGES = 1010 , ITEMS = 100 , COUNT = 10 , CALCULATION = 8 , BOOKS = 5 },
124
+ props = { pages = 1010 , items = 100 , count = 10 , calculation = 8 , books = 5 },
125
125
tags = { ' OFFICE' },
126
126
}))
127
127
end )
128
128
129
129
it (' should search props, tags and todo keywords' , function ()
130
130
local result = Search :new (' CATEGORY="test"&MYPROP=myval+WORK/TODO|NEXT' )
131
131
assert .Is .True (result :check ({
132
- props = { CATEGORY = ' test' , MYPROP = ' myval' , AGE = 10 },
132
+ props = { category = ' test' , myprop = ' myval' , age = 10 },
133
133
tags = { ' WORK' , ' OFFICE' },
134
134
todo = { ' TODO' },
135
135
}))
136
136
assert .Is .True (result :check ({
137
- props = { CATEGORY = ' test' , MYPROP = ' myval' , AGE = 10 },
137
+ props = { category = ' test' , myprop = ' myval' , age = 10 },
138
138
tags = { ' WORK' , ' OFFICE' },
139
139
todo = ' NEXT' ,
140
140
}))
141
141
assert .Is .False (result :check ({
142
- props = { CATEGORY = ' test' , MYPROP = ' myval' , AGE = 10 },
142
+ props = { category = ' test' , myprop = ' myval' , age = 10 },
143
143
tags = { ' WORK' , ' OFFICE' },
144
144
todo = { ' DONE' },
145
145
}))
146
146
147
147
result = Search :new (' CATEGORY="test"+WORK/-WAITING' )
148
148
assert .Is .True (result :check ({
149
- props = { CATEGORY = ' test' },
149
+ props = { category = ' test' },
150
150
tags = { ' WORK' },
151
151
todo = { ' TODO' },
152
152
}))
153
153
154
154
assert .Is .True (result :check ({
155
- props = { CATEGORY = ' test' },
155
+ props = { category = ' test' },
156
156
tags = { ' WORK' },
157
157
todo = { ' DONE' },
158
158
}))
159
159
160
160
assert .Is .False (result :check ({
161
- props = { CATEGORY = ' test' },
161
+ props = { category = ' test' },
162
162
tags = { ' WORK' },
163
163
todo = { ' WAITING' },
164
164
}))
165
165
166
166
assert .Is .False (result :check ({
167
- props = { CATEGORY = ' test_bad' },
167
+ props = { category = ' test_bad' },
168
168
tags = { ' WORK' },
169
169
todo = { ' DONE' },
170
170
}))
171
171
172
172
assert .Is .False (result :check ({
173
- props = { CATEGORY = ' test' },
173
+ props = { category = ' test' },
174
174
tags = { ' OFFICE' },
175
175
todo = { ' DONE' },
176
176
}))
0 commit comments