Merge lp:~zorba-coders/zorba/bug_872732 into lp:zorba

Proposed by Sorin Marian Nasoi
Status: Merged
Approved by: Chris Hillery
Approved revision: 10517
Merged at revision: 10524
Proposed branch: lp:~zorba-coders/zorba/bug_872732
Merge into: lp:zorba
Diff against target: 278 lines (+50/-55)
3 files modified
src/runtime/qnames/qnames_impl.cpp (+41/-48)
test/rbkt/Queries/CMakeLists.txt (+8/-7)
test/rbkt/Queries/w3c_known_failures.txt (+1/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug_872732
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Markos Zaharioudakis Approve
Review via email: mp+79272@code.launchpad.net

Commit message

Fixed the bug #872732 according to the:
- W3C spec: http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri-for-prefix
- W3C decision from : http://www.w3.org/Bugs/Public/show_bug.cgi?id=11590

Marked the test
test/rbkt/w3c_testsuite/XQuery/Functions/QNameFunc/NamespaceURIForPrefixFunc/K2-NamespaceURIForPrefixFunc-2
as expected failure in the:
- test/rbkt/Queries/CMakeLists.txt
- test/rbkt/Queries/w3c_known_failures.txt
because the RQ uses XQTS_1_0_3, where the expected result for this test is wrong.

Description of the change

Fixed the bug #872732 according to the:
- W3C spec: http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri-for-prefix
- W3C decision from : http://www.w3.org/Bugs/Public/show_bug.cgi?id=11590

Marked the test
test/rbkt/w3c_testsuite/XQuery/Functions/QNameFunc/NamespaceURIForPrefixFunc/K2-NamespaceURIForPrefixFunc-2
as expected failure in the:
- test/rbkt/Queries/CMakeLists.txt
- test/rbkt/Queries/w3c_known_failures.txt
because the RQ uses XQTS_1_0_3, where the expected result for this test is wrong.

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

Stupid question regarding the commit: why are there so many whitespace changes in the diff?

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

> Stupid question regarding the commit: why are there so many whitespace changes
> in the diff?

I did not notice that: after installing my machine to Fedora 15 I use a different C++ editor.
This one (from CodeBlocks) has a default value to delete the spaces at the end of the line by default.
My diff is set to ignore white space differences I did not notice this before the commit.

Since this makes a reviewer job more difficult I will set my editor not to delete the spaces before LF.
Thanks for reporting this.

Best,
Sorin

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug_872732 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:272 (message):
  Validation queue job bug_872732-2011-10-24T14-47-03.751Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug_872732-2011-10-24T19-04-02.134Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/runtime/qnames/qnames_impl.cpp'
2--- src/runtime/qnames/qnames_impl.cpp 2011-07-19 19:35:04 +0000
3+++ src/runtime/qnames/qnames_impl.cpp 2011-10-13 13:12:36 +0000
4@@ -1,12 +1,12 @@
5 /*
6 * Copyright 2006-2008 The FLWOR Foundation.
7- *
8+ *
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12- *
13+ *
14 * http://www.apache.org/licenses/LICENSE-2.0
15- *
16+ *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20@@ -52,7 +52,7 @@
21 PlanIteratorState* state;
22 DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
23
24- if (consumeNext(itemQName, theChild0.getp(), planState ))
25+ if (consumeNext(itemQName, theChild0.getp(), planState ))
26 {
27 itemQName->getStringValue2(qname);
28
29@@ -60,7 +60,7 @@
30
31 index = qname.find(":", 0, 1);
32
33- if (index != zstring::npos)
34+ if (index != zstring::npos)
35 {
36 resPre = qname.substr(0, index);
37 resLocal = qname.substr(index+1, qname.size() - index);
38@@ -70,7 +70,7 @@
39 throw XQUERY_EXCEPTION(
40 err::FOCA0002, ERROR_PARAMS( qname ), ERROR_LOC(loc)
41 );
42- }
43+ }
44 else
45 {
46 resLocal = qname;
47@@ -80,8 +80,8 @@
48 err::FOCA0002, ERROR_PARAMS( qname ), ERROR_LOC(loc)
49 );
50 }
51-
52- if (consumeNext(itemElem, theChild1, planState ))
53+
54+ if (consumeNext(itemElem, theChild1, planState ))
55 {
56 itemElem->getNamespaceBindings(NamespaceBindings);
57
58@@ -104,7 +104,7 @@
59 err::FONS0004, ERROR_PARAMS( resPre ), ERROR_LOC( loc )
60 );
61 }
62-
63+
64 GENV_ITEMFACTORY->createQName(result, resNs, resPre, resLocal);
65
66 STACK_PUSH(true, state);
67@@ -128,7 +128,7 @@
68 PlanIteratorState* state;
69 DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
70
71- if (consumeNext(itemURI, theChild0.getp(), planState ))
72+ if (consumeNext(itemURI, theChild0.getp(), planState ))
73 {
74 itemURI->getStringValue2(resNs);
75
76@@ -138,12 +138,12 @@
77 consumeNext(itemQName, theChild1.getp(), planState );
78
79 itemQName->getStringValue2(qname);
80-
81+
82 ascii::trim_whitespace(qname);
83
84 index = qname.find(":", 0, 1);
85
86- if (index != zstring::npos)
87+ if (index != zstring::npos)
88 {
89 if (resNs.empty())
90 throw XQUERY_EXCEPTION(
91@@ -152,12 +152,12 @@
92
93 resPre = qname.substr(0, index);
94 resLocal = qname.substr(index+1, qname.size() - index);
95- }
96+ }
97 else
98 {
99 resLocal = qname;
100 }
101-
102+
103 if ((index != zstring::npos && ! GENV_GCAST.castableToNCName(resPre)) ||
104 ! GENV_GCAST.castableToNCName(resLocal))
105 {
106@@ -209,7 +209,7 @@
107
108 //11.2.2 fn:prefix-from-QName
109 bool PrefixFromQNameIterator::nextImpl(
110- store::Item_t& result,
111+ store::Item_t& result,
112 PlanState& planState) const
113 {
114 store::Item_t item;
115@@ -232,8 +232,8 @@
116
117 //11.2.3 fn:local-name-from-QName
118 bool LocalNameFromQNameIterator::nextImpl(
119- store::Item_t& result,
120- PlanState& planState) const
121+ store::Item_t& result,
122+ PlanState& planState) const
123 {
124 store::Item_t item;
125 zstring localName;
126@@ -253,7 +253,7 @@
127 //11.2.4 fn:namespace-uri-from-QName
128 bool NamespaceUriFromQNameIterator::nextImpl(
129 store::Item_t& result,
130- PlanState& planState) const
131+ PlanState& planState) const
132 {
133 store::Item_t item;
134 zstring ns;
135@@ -277,6 +277,7 @@
136 {
137 store::Item_t itemPrefix, itemElem;
138 zstring resNs;
139+ zstring prefix;
140 bool found = false;
141 store::NsBindings NamespaceBindings;
142 store::NsBindings::const_iterator iter;
143@@ -284,43 +285,35 @@
144 PlanIteratorState* state;
145 DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
146
147-// According to W3C bug #11590 comment #9
148-// http://www.w3.org/Bugs/Public/show_bug.cgi?id=11590#c9
149-// namespace-uri-for-prefix('', <a/>)
150-// and
151-// namespace-uri-for-prefix((), <a/>)
152-// should return the empty sequence
153 if (!consumeNext(itemPrefix, theChildren[0].getp(), planState ))
154 {
155- resNs = theSctx->default_elem_type_ns();
156- found = true;
157- }
158- else
159- {
160- if (!consumeNext(itemElem, theChildren[1].getp(), planState ))
161- {
162- ZORBA_ASSERT(false);
163- }
164- else
165- {
166- itemElem->getNamespaceBindings(NamespaceBindings);
167-
168- for (iter = NamespaceBindings.begin();
169- iter != NamespaceBindings.end();
170- ++iter)
171- {
172- zstring pre;
173- itemPrefix->getStringValue2(pre);
174-
175- ascii::trim_whitespace(pre);
176-
177- if ((*iter).first == pre)
178+ prefix = "";
179+ }
180+ else
181+ {
182+ itemPrefix->getStringValue2(prefix);
183+ ascii::trim_whitespace(prefix);
184+ }
185+
186+ if (!consumeNext(itemElem, theChildren[1].getp(), planState ))
187+ {
188+ ZORBA_ASSERT(false);
189+ }
190+ else
191+ {
192+ itemElem->getNamespaceBindings(NamespaceBindings);
193+
194+ for (iter = NamespaceBindings.begin();
195+ iter != NamespaceBindings.end();
196+ ++iter)
197+ {
198+ if (((*iter).first == prefix) &&
199+ !(*iter).second.empty())
200 {
201 resNs = (*iter).second;
202 found = true;
203 break;
204 }
205- }
206 }
207 }
208
209
210=== modified file 'test/rbkt/Queries/CMakeLists.txt'
211--- test/rbkt/Queries/CMakeLists.txt 2011-10-10 10:31:20 +0000
212+++ test/rbkt/Queries/CMakeLists.txt 2011-10-13 13:12:36 +0000
213@@ -1,11 +1,11 @@
214 # Copyright 2006-2008 The FLWOR Foundation.
215-#
216+#
217 # Licensed under the Apache License, Version 2.0 (the "License");
218 # you may not use this file except in compliance with the License.
219 # You may obtain a copy of the License at
220-#
221+#
222 # http://www.apache.org/licenses/LICENSE-2.0
223-#
224+#
225 # Unless required by applicable law or agreed to in writing, software
226 # distributed under the License is distributed on an "AS IS" BASIS,
227 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
228@@ -18,10 +18,10 @@
229
230 MESSAGE(STATUS "Adding tests for CTest")
231
232-FILE(GLOB_RECURSE TESTFILES FOLLOW_SYMLINKS
233+FILE(GLOB_RECURSE TESTFILES FOLLOW_SYMLINKS
234 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*.xq")
235 IF(ZORBA_TEST_XQUERYX)
236- FILE(GLOB_RECURSE TESTFILES_XQX FOLLOW_SYMLINKS
237+ FILE(GLOB_RECURSE TESTFILES_XQX FOLLOW_SYMLINKS
238 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS "*.xqx")
239 IF (TESTFILES_XQX)
240 LIST(APPEND TESTFILES ${TESTFILES_XQX})
241@@ -94,7 +94,7 @@
242 LIST(SORT CHAINED_TESTS_FILES)
243
244 SET(TEST_NAME "test/rbkt/${TEST_NAME}")
245-
246+
247 # finally add the test
248 ZORBA_ADD_TEST("${TEST_NAME}" testdriver ${CHAINED_TESTS_FILES})
249
250@@ -143,7 +143,7 @@
251 SET(SKIP_TEST 1)
252 ENDIF(HTTP_CLIENT)
253 ENDIF(NOT CURL_FOUND)
254-
255+
256 IF(NOT ZORBA_WITH_FILE_ACCESS)
257 #these tests require the file module
258 STRING(REGEX MATCH "file/" NEEDS_FILE "${TESTNAME}")
259@@ -211,6 +211,7 @@
260 IF (FOUND_XQTS AND NOT ZORBA_TEST_W3C_TO_SUBMIT_RESULTS)
261
262 EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/PathExpr/Steps/Steps-leading-lone-slash-8a 3408285)
263+ EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Functions/QNameFunc/NamespaceURIForPrefixFunc/K2-NamespaceURIForPrefixFunc-2 872732)
264
265 IF(NOT ZORBA_WITH_BIG_INTEGER)
266 # These tests fail due to integer overflow.
267
268=== modified file 'test/rbkt/Queries/w3c_known_failures.txt'
269--- test/rbkt/Queries/w3c_known_failures.txt 2011-09-12 23:22:24 +0000
270+++ test/rbkt/Queries/w3c_known_failures.txt 2011-10-13 13:12:36 +0000
271@@ -107,6 +107,7 @@
272 test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-001
273 test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-008
274 test/rbkt/w3c_testsuite/XQuery/Functions/HigherOrder/MapPairs/map-pairs-902
275+test/rbkt/w3c_testsuite/XQuery/Functions/QNameFunc/NamespaceURIForPrefixFunc/K2-NamespaceURIForPrefixFunc-2
276 test/rbkt/w3c_testsuite/XQuery/SchemaValidation/ValidateExpression/validateexpr-28
277 test/rbkt/w3c_testsuite/XQuery/exprSeqTypes/PrologExpr/VariableProlog/ExternalVariablesWith/K2-ExternalVariablesWith-22
278 test/rbkt/w3c_testsuite/XQuery/StaticTyping/STFLWORExpr/ST-PITest-02

Subscribers

People subscribed via source and target branches