Merge lp:~zorba-coders/zorba/bug-1188061 into lp:zorba/stack-module
- bug-1188061
- Merge into stack-module
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Luis Rodriguez Gonzalez | ||||
Approved revision: | 22 | ||||
Merged at revision: | 15 | ||||
Proposed branch: | lp:~zorba-coders/zorba/bug-1188061 | ||||
Merge into: | lp:zorba/stack-module | ||||
Diff against target: |
474 lines (+161/-70) 26 files modified
src/CMakeLists.txt (+1/-1) src/stack.xq (+62/-61) test/ExpQueryResults/copy-json1.xml.res (+1/-0) test/ExpQueryResults/copy-mix.xml.res (+1/-0) test/ExpQueryResults/create-json1.xml.res (+1/-0) test/ExpQueryResults/empty-json1.xml.res (+1/-0) test/ExpQueryResults/pop-json2.xml.res (+1/-0) test/ExpQueryResults/push-json1.xml.res (+1/-0) test/ExpQueryResults/size-json1.xml.res (+2/-0) test/ExpQueryResults/top-json1.xml.res (+1/-0) test/Queries/copy-json1.xq (+11/-0) test/Queries/copy-mix.xq (+11/-0) test/Queries/copy1.xq (+1/-1) test/Queries/create-json1.xq (+9/-0) test/Queries/create1.xq (+1/-1) test/Queries/empty-json1.xq (+12/-0) test/Queries/empty1.xq (+1/-1) test/Queries/pop-json2.xq (+7/-0) test/Queries/pop1.xq (+1/-1) test/Queries/pop2.xq (+1/-1) test/Queries/push-json1.xq (+6/-0) test/Queries/push1.xq (+1/-1) test/Queries/size-json1.xq (+13/-0) test/Queries/size1.xq (+1/-1) test/Queries/top-json1.xq (+12/-0) test/Queries/top1.xq (+1/-1) |
||||
To merge this branch: | bzr merge lp:~zorba-coders/zorba/bug-1188061 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juan Zacarias | Approve | ||
Luis Rodriguez Gonzalez | Approve | ||
Chris Hillery | Approve | ||
Review via email: mp+169553@code.launchpad.net |
Commit message
Update to 3.0 module guidelines; make JSON-ready.
Description of the change
Chris Hillery (ceejatec) wrote : | # |
Also, Luis: Have you done any investigation to ensure that the documentation is reasonable? In particular is the header comment clear, clean, and possibly have an example or two?
And, can you verify that all reasonably-possible error conditions are documented? At least, are there any other XQuery error codes thrown by the module functions (or from the module C++ code, if any)?
Luis Rodriguez Gonzalez (kuraru) wrote : | # |
The documentation has several mentions to tests that are included but no
textual representations are made, Should I move some of the examples to the
code instead of sending the user to check the tests?
Aside from that the documentation seems to be pretty straight forward and
all the errors that I can think for each case seems to be covered.
Thanks,
Luis.
2013/6/14 Chris Hillery <email address hidden>
> Also, Luis: Have you done any investigation to ensure that the
> documentation is reasonable? In particular is the header comment clear,
> clean, and possibly have an example or two?
>
> And, can you verify that all reasonably-possible error conditions are
> documented? At least, are there any other XQuery error codes thrown by the
> module functions (or from the module C++ code, if any)?
> --
> https:/
> You proposed lp:~zorba-coders/zorba/bug-1188061 for merging.
>
--
"The significant problems we face cannot be solved by the same level of
thinking that created them." -- Albert Einstein
- 14. By Luis Rodriguez Gonzalez
-
Header fixed
Chris Hillery (ceejatec) wrote : | # |
> The documentation has several mentions to tests that are included but no
> textual representations are made, Should I move some of the examples to the
> code instead of sending the user to check the tests?
No, the @example tags are better. The examples will be included in the documentation when the website is generated, but by having them under the test/ directory they're actually executed as part of the RQ, so we know they actually work.
Chris Hillery (ceejatec) wrote : | # |
Luis - thanks for getting to this module so quickly. Based on this you've raised some coding-guideline issues, such as the use of <p/> and error codes. After discussion with Matthias, I've proposed some clarifications to the coding guidelines document on the Wiki; please take a look and update this proposal accordingly. Thanks!
Chris Hillery (ceejatec) wrote : | # |
After that, I'm afraid we've got some more substantive changes to be made to JSON-ify this module. I'll update the bug with details. If you'd like, we could merge this first pass (after you've addressed the coding guidelines issues) and then have a separate proposal for the JSONiq updates; otherwise you can continue working on this branch.
Chris Hillery (ceejatec) : | # |
- 15. By Luis Rodriguez Gonzalez
-
Added the ability to manage JSON structures and added a JSON test case
- 16. By Luis Rodriguez Gonzalez
-
Fixed documentation and code issues. Also added several new testcases
Luis Rodriguez Gonzalez (kuraru) wrote : | # |
> After that, I'm afraid we've got some more substantive changes to be made to
> JSON-ify this module. I'll update the bug with details. If you'd like, we
> could merge this first pass (after you've addressed the coding guidelines
> issues) and then have a separate proposal for the JSONiq updates; otherwise
> you can continue working on this branch.
I worked in the changes, please check it, also added some testcases for the new behavior.
- 17. By Luis Rodriguez Gonzalez
-
Forgot to add the new testcases
- 18. By Luis Rodriguez Gonzalez
-
Added another testcase to test mixed content (JSON and XML)
- 19. By Luis Rodriguez Gonzalez
-
Removing backup files added by mistake
Chris Hillery (ceejatec) wrote : | # |
Basically the same comments as the queue proposal:
1. Make the error QName variables %private;
2. Fix or eliminate the XQDoc for the error QNames;
3. Replace "node" with "item" in function XQDoc.
In addition:
4. You have a stray <p> at the beginning of the header XQDoc comment (diff line 21).
5. You have </p> in at least 8 places, instead of <p/>.
- 20. By Luis Rodriguez Gonzalez
-
Constants declared as private. Removed <p> and changed </p> for <p/>. Removed comments for private variables.
- 21. By Luis Rodriguez Gonzalez
-
All references to nodes were changed to items.
- 22. By Chris Hillery
-
Updated header comment.
Chris Hillery (ceejatec) : | # |
Luis Rodriguez Gonzalez (kuraru) : | # |
Juan Zacarias (juan457) : | # |
- 23. By Chris Hillery
-
Updating expected results.
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue succeeded - proposal merged!
Preview Diff
1 | === modified file 'src/CMakeLists.txt' |
2 | --- src/CMakeLists.txt 2012-02-29 08:49:50 +0000 |
3 | +++ src/CMakeLists.txt 2013-07-17 01:17:24 +0000 |
4 | @@ -15,6 +15,6 @@ |
5 | |
6 | ##### Stack data structure |
7 | |
8 | -DECLARE_ZORBA_MODULE (URI "http://www.zorba-xquery.com/modules/store/data-structures/stack" VERSION 1.0 FILE "stack.xq") |
9 | +DECLARE_ZORBA_MODULE (URI "http://zorba.io/modules/stack" VERSION 1.0 FILE "stack.xq") |
10 | |
11 | ADD_TEST_DIRECTORY("${PROJECT_SOURCE_DIR}/test") |
12 | |
13 | === modified file 'src/stack.xq' |
14 | --- src/stack.xq 2013-06-15 19:49:12 +0000 |
15 | +++ src/stack.xq 2013-07-17 01:17:24 +0000 |
16 | @@ -17,12 +17,15 @@ |
17 | :) |
18 | |
19 | (:~ |
20 | - : Implementation of stack for node items, using dynamic collections.<br /> |
21 | + : Implementation of stack for items, using dynamic collections.<p/> |
22 | + : |
23 | + : Entries in the stack must be structured items - that is, either JSON |
24 | + : Objects or Arrays, or XML Nodes. <p/> |
25 | : |
26 | : @author Daniel Turcanu, Sorin Nasoi |
27 | : @project Zorba/Data Store/Data Structures/Stack |
28 | :) |
29 | -module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
30 | +module namespace stack = "http://zorba.io/modules/stack"; |
31 | |
32 | import module namespace collections-ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl"; |
33 | import module namespace collections-dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml"; |
34 | @@ -31,119 +34,117 @@ |
35 | declare namespace ver = "http://www.zorba-xquery.com/options/versioning"; |
36 | declare option ver:module-version "1.0"; |
37 | |
38 | -(:~ |
39 | - : Errors namespace URI. |
40 | -:) |
41 | -declare variable $stack:errNS as xs:string := "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
42 | +declare %private variable $stack:errNS as xs:string := "http://zorba.io/modules/stack"; |
43 | |
44 | -(:~ |
45 | - : xs:QName with namespace URI="http://www.zorba-xquery.com/modules/store/data-structures/stack" and local name "errNA" |
46 | -:) |
47 | -declare variable $stack:errNA as xs:QName := fn:QName($stack:errNS, "stack:errNA"); |
48 | - |
49 | -(:~ |
50 | - : xs:QName with namespace URI="http://www.zorba-xquery.com/modules/store/data-structures/stack" and local name "errExists" |
51 | -:) |
52 | -declare variable $stack:errExists as xs:QName := fn:QName($stack:errNS, "stack:errExists"); |
53 | - |
54 | -(:~ |
55 | - : Create a stack with this name. <br /> If stack exists, an error is raised. |
56 | - : @param $name name of the new stack. |
57 | - : @return () |
58 | - : @error stack:errExists if the stack identified by $name already exists. |
59 | +declare %private variable $stack:NOT-EXISTS as xs:QName := fn:QName($stack:errNS, "stack:NOT-EXISTS"); |
60 | + |
61 | +declare %private variable $stack:EXISTS as xs:QName := fn:QName($stack:errNS, "stack:EXISTS"); |
62 | + |
63 | +(:~ |
64 | + : Create a stack with this name. If stack exists, an error is raised. <p/> |
65 | + : |
66 | + : @param $name name of the new stack. |
67 | + : @return an empty sequence. |
68 | + : @error stack:EXISTS if the stack identified by $name already exists. |
69 | :) |
70 | declare %ann:sequential function stack:create($name as xs:QName) as empty-sequence() |
71 | { |
72 | if(collections-ddl:is-available-collection($name)) then |
73 | - fn:error($stack:errExists, "Stack already exists."); |
74 | + fn:error($stack:EXISTS, "Stack already exists."); |
75 | else |
76 | collections-ddl:create($name); |
77 | }; |
78 | |
79 | (:~ |
80 | - : Return the top node in the stack, without removing it. |
81 | - : @param $name name of the stack. |
82 | - : @return the top node, or empty sequence if stack is empty. |
83 | + : Return the top item in the stack, without removing it. <p/> |
84 | + : |
85 | + : @param $name name of the stack. |
86 | + : @return the top item, or empty sequence if stack is empty. |
87 | : @example test/Queries/top1.xq |
88 | - : @error stack:errNA if the stack identified by $name does not exist. |
89 | + : @error stack:NOT-EXISTS if the stack identified by $name does not exist. |
90 | :) |
91 | -declare function stack:top($name as xs:QName) as node()? |
92 | +declare function stack:top($name as xs:QName) as structured-item()? |
93 | { |
94 | if(not(collections-ddl:is-available-collection($name))) then |
95 | - fn:error($stack:errNA, "Stack does not exist.") |
96 | + fn:error($stack:NOT-EXISTS, "Stack does not exist.") |
97 | else |
98 | collections-dml:collection($name)[1] |
99 | }; |
100 | |
101 | (:~ |
102 | - : Return the top node in the stack, and remove it. |
103 | - : @param $name name of the stack. |
104 | - : @return the top node, or empty sequence if stack is empty. |
105 | + : Return the top item in the stack, and remove it. <p/> |
106 | + : |
107 | + : @param $name name of the stack. |
108 | + : @return the top item, or empty sequence if stack is empty. |
109 | : @example test/Queries/pop2.xq |
110 | - : @error stack:errNA if the stack identified by $name does not exist. |
111 | + : @error stack:NOT-EXISTS if the stack identified by $name does not exist. |
112 | :) |
113 | -declare %ann:sequential function stack:pop($name as xs:QName) as node()? |
114 | +declare %ann:sequential function stack:pop($name as xs:QName) as structured-item()? |
115 | { |
116 | if(not(collections-ddl:is-available-collection($name))) then |
117 | - fn:error($stack:errNA, "Stack does not exist.") |
118 | + fn:error($stack:NOT-EXISTS, "Stack does not exist.") |
119 | else |
120 | { |
121 | - variable $topNode := collections-dml:collection($name)[1]; |
122 | - collections-dml:delete-node-first($name); |
123 | - $topNode |
124 | + variable $topItem := collections-dml:collection($name)[1]; |
125 | + collections-dml:delete-first($name); |
126 | + $topItem |
127 | } |
128 | }; |
129 | |
130 | (:~ |
131 | - : Add a new node to the stack; the stack will contain a copy of the given node. |
132 | - : @param $name name of the stack. |
133 | - : @param $value the node to be added. |
134 | - : @return () |
135 | + : Add a new item to the stack; the stack will contain a copy of the given item. <p/> |
136 | + : |
137 | + : @param $name name of the stack. |
138 | + : @param $value the item to be added. |
139 | + : @return an empty sequence. |
140 | : @example test/Queries/push1.xq |
141 | - : @error stack:errNA if the stack identified by $name does not exist. |
142 | + : @error stack:NOT-EXISTS if the stack identified by $name does not exist. |
143 | :) |
144 | -declare %ann:sequential function stack:push($name as xs:QName, $value as node()) as empty-sequence() |
145 | +declare %ann:sequential function stack:push($name as xs:QName, $value as structured-item()) as empty-sequence() |
146 | { |
147 | - collections-dml:apply-insert-nodes-first($name, $value); |
148 | + collections-dml:apply-insert-first($name, $value); |
149 | }; |
150 | |
151 | (:~ |
152 | - : Checks if a stack exists and is empty. |
153 | - : @param $name name of the stack. |
154 | - : @return true is the stack is empty or does not exist. |
155 | + : Checks if a stack exists and is empty. <p/> |
156 | + : |
157 | + : @param $name name of the stack. |
158 | + : @return true if the stack is empty or does not exist. |
159 | : @example test/Queries/empty1.xq |
160 | - : @error stack:errNA if the stack identified by $name does not exist. |
161 | + : @error stack:NOT-EXISTS if the stack identified by $name does not exist. |
162 | :) |
163 | declare function stack:empty($name as xs:QName) as xs:boolean |
164 | { |
165 | if(not(collections-ddl:is-available-collection($name))) then |
166 | - fn:error($stack:errNA, "Stack does not exist.") |
167 | + fn:error($stack:NOT-EXISTS, "Stack does not exist.") |
168 | else |
169 | fn:empty(collections-dml:collection($name)) |
170 | }; |
171 | |
172 | (:~ |
173 | - : Count of nodes in the stack. |
174 | - : @param $name name of the stack. |
175 | - : @return the count of nodes. |
176 | + : Count of items in the stack. <p/> |
177 | + : |
178 | + : @param $name name of the stack. |
179 | + : @return the amount of items. |
180 | : @example test/Queries/size1.xq |
181 | - : @error stack:errNA if the stack identified by $name does not exist. |
182 | + : @error stack:NOT-EXISTS if the stack identified by $name does not exist. |
183 | :) |
184 | declare function stack:size($name as xs:QName) as xs:integer |
185 | { |
186 | if(not(collections-ddl:is-available-collection($name))) then |
187 | - fn:error($stack:errNA, "Stack does not exist.") |
188 | + fn:error($stack:NOT-EXISTS, "Stack does not exist.") |
189 | else |
190 | fn:count(collections-dml:collection($name)) |
191 | }; |
192 | |
193 | (:~ |
194 | - : Copy all nodes from source stack to a destination stack.<br /> |
195 | - : If destination stack does not exist, it is created first.<br /> |
196 | - : If destination stack is not empty, the nodes are appended on top. |
197 | - : @param $destName name of the destination stack. |
198 | - : @param $sourceName name of the source stack. |
199 | - : @return () |
200 | + : Copy all items from source stack to a destination stack. <p/> |
201 | + : If destination stack does not exist, it is created first. <p/> |
202 | + : If destination stack is not empty, the items are appended on top. <p/> |
203 | + : |
204 | + : @param $destName name of the destination stack. |
205 | + : @param $sourceName name of the source stack. |
206 | + : @return an empty sequence. |
207 | : @example test/Queries/copy1.xq |
208 | :) |
209 | declare %ann:sequential function stack:copy($destName as xs:QName, $sourceName as xs:QName) as empty-sequence() |
210 | @@ -152,5 +153,5 @@ |
211 | collections-ddl:create($destName); |
212 | else |
213 | (); |
214 | - collections-dml:insert-nodes-first($destName, collections-dml:collection($sourceName)); |
215 | + collections-dml:insert-first($destName, collections-dml:collection($sourceName)); |
216 | }; |
217 | |
218 | === added file 'test/ExpQueryResults/copy-json1.xml.res' |
219 | --- test/ExpQueryResults/copy-json1.xml.res 1970-01-01 00:00:00 +0000 |
220 | +++ test/ExpQueryResults/copy-json1.xml.res 2013-07-17 01:17:24 +0000 |
221 | @@ -0,0 +1,1 @@ |
222 | +{ "c" : null }{ "c" : null } |
223 | \ No newline at end of file |
224 | |
225 | === added file 'test/ExpQueryResults/copy-mix.xml.res' |
226 | --- test/ExpQueryResults/copy-mix.xml.res 1970-01-01 00:00:00 +0000 |
227 | +++ test/ExpQueryResults/copy-mix.xml.res 2013-07-17 01:17:24 +0000 |
228 | @@ -0,0 +1,1 @@ |
229 | +{ "c" : null }{ "c" : null } |
230 | \ No newline at end of file |
231 | |
232 | === added file 'test/ExpQueryResults/create-json1.xml.res' |
233 | --- test/ExpQueryResults/create-json1.xml.res 1970-01-01 00:00:00 +0000 |
234 | +++ test/ExpQueryResults/create-json1.xml.res 2013-07-17 01:17:24 +0000 |
235 | @@ -0,0 +1,1 @@ |
236 | +{ "a" : 1 } |
237 | \ No newline at end of file |
238 | |
239 | === added file 'test/ExpQueryResults/empty-json1.xml.res' |
240 | --- test/ExpQueryResults/empty-json1.xml.res 1970-01-01 00:00:00 +0000 |
241 | +++ test/ExpQueryResults/empty-json1.xml.res 2013-07-17 01:17:24 +0000 |
242 | @@ -0,0 +1,1 @@ |
243 | +{ "a" : 0 }false{ "a" : 0 }true |
244 | \ No newline at end of file |
245 | |
246 | === added file 'test/ExpQueryResults/pop-json2.xml.res' |
247 | --- test/ExpQueryResults/pop-json2.xml.res 1970-01-01 00:00:00 +0000 |
248 | +++ test/ExpQueryResults/pop-json2.xml.res 2013-07-17 01:17:24 +0000 |
249 | @@ -0,0 +1,1 @@ |
250 | +{ "a" : 0 } |
251 | \ No newline at end of file |
252 | |
253 | === added file 'test/ExpQueryResults/push-json1.xml.res' |
254 | --- test/ExpQueryResults/push-json1.xml.res 1970-01-01 00:00:00 +0000 |
255 | +++ test/ExpQueryResults/push-json1.xml.res 2013-07-17 01:17:24 +0000 |
256 | @@ -0,0 +1,1 @@ |
257 | +{ "a" : 1 } |
258 | \ No newline at end of file |
259 | |
260 | === added file 'test/ExpQueryResults/size-json1.xml.res' |
261 | --- test/ExpQueryResults/size-json1.xml.res 1970-01-01 00:00:00 +0000 |
262 | +++ test/ExpQueryResults/size-json1.xml.res 2013-07-17 01:17:24 +0000 |
263 | @@ -0,0 +1,2 @@ |
264 | +<?xml version="1.0" encoding="UTF-8"?> |
265 | +0{ "phi" : 1.6180339 }1{ "phi" : 1.6180339 }0 |
266 | \ No newline at end of file |
267 | |
268 | === added file 'test/ExpQueryResults/top-json1.xml.res' |
269 | --- test/ExpQueryResults/top-json1.xml.res 1970-01-01 00:00:00 +0000 |
270 | +++ test/ExpQueryResults/top-json1.xml.res 2013-07-17 01:17:24 +0000 |
271 | @@ -0,0 +1,1 @@ |
272 | +{ "a" : null }{ "a" : null }{ "z" : 9.999 } |
273 | \ No newline at end of file |
274 | |
275 | === added file 'test/Queries/copy-json1.xq' |
276 | --- test/Queries/copy-json1.xq 1970-01-01 00:00:00 +0000 |
277 | +++ test/Queries/copy-json1.xq 2013-07-17 01:17:24 +0000 |
278 | @@ -0,0 +1,11 @@ |
279 | +import module namespace stack = "http://zorba.io/modules/stack"; |
280 | + |
281 | +variable $stName := fn:QName("", "stack1"); |
282 | +variable $stCopy := fn:QName("", "stackcopy"); |
283 | +stack:create($stName); |
284 | +stack:push($stName, { "a" : 1 }); |
285 | +stack:push($stName, { "b" : 2.1 }); |
286 | +stack:push($stName, { "c" : jn:null() }); |
287 | +stack:copy($stCopy, $stName); |
288 | +(stack:top($stName), |
289 | +stack:top($stCopy)) |
290 | |
291 | === added file 'test/Queries/copy-mix.xq' |
292 | --- test/Queries/copy-mix.xq 1970-01-01 00:00:00 +0000 |
293 | +++ test/Queries/copy-mix.xq 2013-07-17 01:17:24 +0000 |
294 | @@ -0,0 +1,11 @@ |
295 | +import module namespace stack = "http://zorba.io/modules/stack"; |
296 | + |
297 | +variable $stName := fn:QName("", "stack1"); |
298 | +variable $stCopy := fn:QName("", "stackcopy"); |
299 | +stack:create($stName); |
300 | +stack:push($stName, { "a" : 1 }); |
301 | +stack:push($stName, <b/>); |
302 | +stack:push($stName, { "c" : jn:null() }); |
303 | +stack:copy($stCopy, $stName); |
304 | +(stack:top($stName), |
305 | +stack:top($stCopy)) |
306 | |
307 | === modified file 'test/Queries/copy1.xq' |
308 | --- test/Queries/copy1.xq 2012-02-29 08:49:50 +0000 |
309 | +++ test/Queries/copy1.xq 2013-07-17 01:17:24 +0000 |
310 | @@ -1,4 +1,4 @@ |
311 | -import module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
312 | +import module namespace stack = "http://zorba.io/modules/stack"; |
313 | |
314 | variable $stName := fn:QName("", "stack1"); |
315 | variable $stCopy := fn:QName("", "stackcopy"); |
316 | |
317 | === added file 'test/Queries/create-json1.xq' |
318 | --- test/Queries/create-json1.xq 1970-01-01 00:00:00 +0000 |
319 | +++ test/Queries/create-json1.xq 2013-07-17 01:17:24 +0000 |
320 | @@ -0,0 +1,9 @@ |
321 | +import module namespace stack = "http://zorba.io/modules/stack"; |
322 | + |
323 | +variable $stName := fn:QName("", "stack1"); |
324 | +( |
325 | + stack:create($stName), |
326 | + stack:push($stName, { "z" : 27 }), |
327 | + stack:push($stName, { "a" : 1 }), |
328 | + stack:top($stName) |
329 | +) |
330 | |
331 | === modified file 'test/Queries/create1.xq' |
332 | --- test/Queries/create1.xq 2012-03-23 07:56:19 +0000 |
333 | +++ test/Queries/create1.xq 2013-07-17 01:17:24 +0000 |
334 | @@ -1,4 +1,4 @@ |
335 | -import module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
336 | +import module namespace stack = "http://zorba.io/modules/stack"; |
337 | |
338 | variable $stName := fn:QName("", "stack1"); |
339 | ( |
340 | |
341 | === added file 'test/Queries/empty-json1.xq' |
342 | --- test/Queries/empty-json1.xq 1970-01-01 00:00:00 +0000 |
343 | +++ test/Queries/empty-json1.xq 2013-07-17 01:17:24 +0000 |
344 | @@ -0,0 +1,12 @@ |
345 | +import module namespace stack = "http://zorba.io/modules/stack"; |
346 | + |
347 | +variable $stName := fn:QName("", "stack1"); |
348 | +( |
349 | + stack:create($stName), |
350 | + stack:push($stName, { "a" : 0 }), |
351 | + stack:top($stName), |
352 | + stack:empty($stName), |
353 | + stack:pop($stName), |
354 | + stack:top($stName), |
355 | + stack:empty($stName) |
356 | +) |
357 | |
358 | === modified file 'test/Queries/empty1.xq' |
359 | --- test/Queries/empty1.xq 2012-03-23 07:56:19 +0000 |
360 | +++ test/Queries/empty1.xq 2013-07-17 01:17:24 +0000 |
361 | @@ -1,4 +1,4 @@ |
362 | -import module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
363 | +import module namespace stack = "http://zorba.io/modules/stack"; |
364 | |
365 | variable $stName := fn:QName("", "stack1"); |
366 | ( |
367 | |
368 | === added file 'test/Queries/pop-json2.xq' |
369 | --- test/Queries/pop-json2.xq 1970-01-01 00:00:00 +0000 |
370 | +++ test/Queries/pop-json2.xq 2013-07-17 01:17:24 +0000 |
371 | @@ -0,0 +1,7 @@ |
372 | +import module namespace stack = "http://zorba.io/modules/stack"; |
373 | + |
374 | +variable $stName := fn:QName("", "stack1"); |
375 | +stack:create($stName); |
376 | +stack:push($stName, { "b" : 1 }); |
377 | +stack:push($stName, { "a" : 0 }); |
378 | +stack:pop($stName) |
379 | |
380 | === modified file 'test/Queries/pop1.xq' |
381 | --- test/Queries/pop1.xq 2012-02-29 08:49:50 +0000 |
382 | +++ test/Queries/pop1.xq 2013-07-17 01:17:24 +0000 |
383 | @@ -1,4 +1,4 @@ |
384 | -import module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
385 | +import module namespace stack = "http://zorba.io/modules/stack"; |
386 | |
387 | variable $stName := fn:QName("", "stack1"); |
388 | stack:create($stName); |
389 | |
390 | === modified file 'test/Queries/pop2.xq' |
391 | --- test/Queries/pop2.xq 2012-02-29 08:49:50 +0000 |
392 | +++ test/Queries/pop2.xq 2013-07-17 01:17:24 +0000 |
393 | @@ -1,4 +1,4 @@ |
394 | -import module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
395 | +import module namespace stack = "http://zorba.io/modules/stack"; |
396 | |
397 | variable $stName := fn:QName("", "stack1"); |
398 | stack:create($stName); |
399 | |
400 | === added file 'test/Queries/push-json1.xq' |
401 | --- test/Queries/push-json1.xq 1970-01-01 00:00:00 +0000 |
402 | +++ test/Queries/push-json1.xq 2013-07-17 01:17:24 +0000 |
403 | @@ -0,0 +1,6 @@ |
404 | +import module namespace stack = "http://zorba.io/modules/stack"; |
405 | + |
406 | +variable $stName := fn:QName("", "stack1"); |
407 | +stack:create($stName); |
408 | +stack:push($stName, {"a" : 1}); |
409 | +stack:pop($stName) |
410 | |
411 | === modified file 'test/Queries/push1.xq' |
412 | --- test/Queries/push1.xq 2012-02-29 08:49:50 +0000 |
413 | +++ test/Queries/push1.xq 2013-07-17 01:17:24 +0000 |
414 | @@ -1,4 +1,4 @@ |
415 | -import module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
416 | +import module namespace stack = "http://zorba.io/modules/stack"; |
417 | |
418 | variable $stName := fn:QName("", "stack1"); |
419 | stack:create($stName); |
420 | |
421 | === added file 'test/Queries/size-json1.xq' |
422 | --- test/Queries/size-json1.xq 1970-01-01 00:00:00 +0000 |
423 | +++ test/Queries/size-json1.xq 2013-07-17 01:17:24 +0000 |
424 | @@ -0,0 +1,13 @@ |
425 | +import module namespace stack = "http://zorba.io/modules/stack"; |
426 | + |
427 | +variable $stName := fn:QName("", "stack1"); |
428 | +( |
429 | + stack:create($stName), |
430 | + stack:size($stName), |
431 | + stack:push($stName, { "phi" : 1.6180339 }), |
432 | + stack:top($stName), |
433 | + stack:size($stName), |
434 | + stack:pop($stName), |
435 | + stack:top($stName), |
436 | + stack:size($stName) |
437 | +) |
438 | |
439 | === modified file 'test/Queries/size1.xq' |
440 | --- test/Queries/size1.xq 2012-03-23 07:56:19 +0000 |
441 | +++ test/Queries/size1.xq 2013-07-17 01:17:24 +0000 |
442 | @@ -1,4 +1,4 @@ |
443 | -import module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
444 | +import module namespace stack = "http://zorba.io/modules/stack"; |
445 | |
446 | variable $stName := fn:QName("", "stack1"); |
447 | ( |
448 | |
449 | === added file 'test/Queries/top-json1.xq' |
450 | --- test/Queries/top-json1.xq 1970-01-01 00:00:00 +0000 |
451 | +++ test/Queries/top-json1.xq 2013-07-17 01:17:24 +0000 |
452 | @@ -0,0 +1,12 @@ |
453 | +import module namespace stack = "http://zorba.io/modules/stack"; |
454 | + |
455 | +variable $stName := fn:QName("", "stack1"); |
456 | +( |
457 | + stack:create($stName), |
458 | + stack:push($stName, { "z" : 9.999 }), |
459 | + stack:push($stName, { "a" : jn:null() }), |
460 | + stack:top($stName), |
461 | + stack:pop($stName), |
462 | + stack:pop($stName), |
463 | + stack:top($stName) |
464 | +) |
465 | |
466 | === modified file 'test/Queries/top1.xq' |
467 | --- test/Queries/top1.xq 2012-02-29 08:49:50 +0000 |
468 | +++ test/Queries/top1.xq 2013-07-17 01:17:24 +0000 |
469 | @@ -1,4 +1,4 @@ |
470 | -import module namespace stack = "http://www.zorba-xquery.com/modules/store/data-structures/stack"; |
471 | +import module namespace stack = "http://zorba.io/modules/stack"; |
472 | |
473 | variable $stName := fn:QName("", "stack1"); |
474 | ( |
Looks pretty good so far! A couple questions for Matthias since he wrote the style guide:
1. Is this the correct way to use <p> for splitting doc paragraphs - wrapping them in <p>...</p> ? Or should there be single <p /> elements between paragraphs?
2. Is this the correct way to refer to error codes? I think there's supposed to be an actual module constant for each code, right? And then @error should list the constant?