possible bug - using inline functions in unit tests
Thursday, 20 March 2014 · 10 messages · last reply 25 Mar 2014
JT
Jan Techter20 Mar 2014 18:35 #
Dear basex team,
running the following unit test involving a simple anonymous function
declare
%unit:test
function local:test-inline-function() {
let $f := function($x) {$x+1}
return unit:assert-equals( $f(5), 6)
};raises a java exception
[exec] Improper use? Potential bug? Your feedback is welcome: [exec] Contact: basex-talk at mailman.uni-konstanz.de
[exec] Version: BaseX 7.8
[exec] Java: Oracle Corporation, 1.7.0_51
[exec] OS: Linux, i386
[exec] Stack Trace:
[exec] java.lang.ClassCastException:
org.basex.query.value.type.AtomType cannot be cast to
org.basex.query.value.type.FuncType
[exec] at
org.basex.query.func.InlineFunc.item(InlineFunc.java:261)
[exec] at
org.basex.query.func.InlineFunc.value(InlineFunc.java:280)
[exec] at
org.basex.query.QueryContext.value(QueryContext.java:367)
[exec] at org.basex.query.gflwor.Let$LetEval.next(Let.java:230) [exec] at org.basex.query.gflwor.GFLWOR$2.next(GFLWOR.java:73) [exec] at org.basex.query.iter.Iter.value(Iter.java:64) [exec] at org.basex.query.expr.ParseExpr.value(ParseExpr.java:71) [exec] at
org.basex.query.QueryContext.value(QueryContext.java:367)
[exec] at
org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) [exec] at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) [exec] at org.basex.query.func.FuncCall.value(FuncCall.java:138) [exec] at
org.basex.query.func.StaticFunc.invokeValue(StaticFunc.java:215) [exec] at org.basex.query.util.unit.Unit.eval(Unit.java:210) [exec] at org.basex.query.util.unit.Unit.test(Unit.java:127) [exec] at org.basex.query.util.unit.Unit.test(Unit.java:51) [exec] at org.basex.query.func.FNUnit.test(FNUnit.java:100) [exec] at org.basex.query.func.FNUnit.item(FNUnit.java:40) [exec] at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46) [exec] at org.basex.query.MainModule.iter(MainModule.java:96) [exec] at org.basex.query.QueryContext.iter(QueryContext.java:310) [exec] at
org.basex.query.QueryProcessor.iter(QueryProcessor.java:81)
[exec] at org.basex.core.cmd.AQuery.query(AQuery.java:89) [exec] at org.basex.core.cmd.XQuery.run(XQuery.java:22) [exec] at org.basex.core.Command.run(Command.java:329) [exec] at org.basex.core.Command.execute(Command.java:94) [exec] at
org.basex.server.LocalSession.execute(LocalSession.java:121) [exec] at org.basex.server.Session.execute(Session.java:37) [exec] at org.basex.core.Main.execute(Main.java:146) [exec] at org.basex.BaseX.<init>(BaseX.java:119)
[exec] at org.basex.BaseX.main(BaseX.java:38)
[exec]
updating to basex 7.8.1 didnt make any difference.
Is this a bug?
Best regards.
Jan
CG
Christian Grün20 Mar 2014 22:21 #
Hi Jan,
the bug seems to be fixed already in the latest snapshot [1]; could you give it a try?
Christian
[1] http://files.basex.org/releases/latest/
Quoted text · Jan Techter · 71 lines
On Thu, Mar 20, 2014 at 6:35 PM, Jan Techter <techter at mailbox.tu-berlin.de> wrote: > Dear basex team, > > running the following unit test involving a simple anonymous function > > declare > %unit:test > function local:test-inline-function() { > let $f := function($x) {$x+1} > return unit:assert-equals( $f(5), 6) > }; > > raises a java exception > > [exec] Improper use? Potential bug? Your feedback is welcome: > [exec] Contact: basex-talk at mailman.uni-konstanz.de > [exec] Version: BaseX 7.8 > [exec] Java: Oracle Corporation, 1.7.0_51 > [exec] OS: Linux, i386 > [exec] Stack Trace: > [exec] java.lang.ClassCastException: > org.basex.query.value.type.AtomType cannot be cast to > org.basex.query.value.type.FuncType > [exec] at org.basex.query.func.InlineFunc.item(InlineFunc.java:261) > [exec] at > org.basex.query.func.InlineFunc.value(InlineFunc.java:280) > [exec] at org.basex.query.QueryContext.value(QueryContext.java:367) > [exec] at org.basex.query.gflwor.Let$LetEval.next(Let.java:230) > [exec] at org.basex.query.gflwor.GFLWOR$2.next(GFLWOR.java:73) > [exec] at org.basex.query.iter.Iter.value(Iter.java:64) > [exec] at org.basex.query.expr.ParseExpr.value(ParseExpr.java:71) > [exec] at org.basex.query.QueryContext.value(QueryContext.java:367) > [exec] at > org.basex.query.func.StaticFunc.invValue(StaticFunc.java:203) > [exec] at org.basex.query.func.FuncCall.invoke(FuncCall.java:96) > [exec] at org.basex.query.func.FuncCall.value(FuncCall.java:138) > [exec] at > org.basex.query.func.StaticFunc.invokeValue(StaticFunc.java:215) > [exec] at org.basex.query.util.unit.Unit.eval(Unit.java:210) > [exec] at org.basex.query.util.unit.Unit.test(Unit.java:127) > [exec] at org.basex.query.util.unit.Unit.test(Unit.java:51) > [exec] at org.basex.query.func.FNUnit.test(FNUnit.java:100) > [exec] at org.basex.query.func.FNUnit.item(FNUnit.java:40) > [exec] at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46) > [exec] at org.basex.query.MainModule.iter(MainModule.java:96) > [exec] at org.basex.query.QueryContext.iter(QueryContext.java:310) > [exec] at > org.basex.query.QueryProcessor.iter(QueryProcessor.java:81) > [exec] at org.basex.core.cmd.AQuery.query(AQuery.java:89) > [exec] at org.basex.core.cmd.XQuery.run(XQuery.java:22) > [exec] at org.basex.core.Command.run(Command.java:329) > [exec] at org.basex.core.Command.execute(Command.java:94) > [exec] at > org.basex.server.LocalSession.execute(LocalSession.java:121) > [exec] at org.basex.server.Session.execute(Session.java:37) > [exec] at org.basex.core.Main.execute(Main.java:146) > [exec] at org.basex.BaseX.<init>(BaseX.java:119) > [exec] at org.basex.BaseX.main(BaseX.java:38) > [exec] > > updating to basex 7.8.1 didnt make any difference. > Is this a bug? > > Best regards. > Jan > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
SS
I truied, it does not work:
[copy] Copying 21 files to /Users/sechel/workspace/dgdgallery/build/backend/data DGD Bibtex test suite:
[exec] Improper use? Potential bug? Your feedback is welcome: [exec] Contact: basex-talk at mailman.uni-konstanz.de
[exec] Version: BaseX 8.0 beta e30d942
[exec] Java: Oracle Corporation, 1.8.0-ea
[exec] OS: Mac OS X, x86_64
[exec] Stack Trace:
[exec] java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be cast to org.basex.query.value.type.FuncType [exec] at org.basex.query.func.Closure.item(Closure.java:275) [exec] at org.basex.query.func.Closure.value(Closure.java:295) [exec] at org.basex.query.QueryContext.value(QueryContext.java:407) [exec] at org.basex.query.gflwor.Let$LetEval.next(Let.java:229) [exec] at org.basex.query.gflwor.GFLWOR$2.next(GFLWOR.java:74)
Stefan Sechelmann
DFG-Forschungszentrum Matheon
Mathematik für Schlüsseltechnologien
Technische Universität Berlin
Sekretariat MA 8-3 Tel. 030/314 29 486
Straße des 17. Juni 136 Fax 030/314 79 282
10623 Berlin sechel at math.tu-berlin.de
http://www.math.tu-berlin.de/~sechel
Quoted text · Jan Techter · 7 lines
Am 20.03.2014 um 18:35 schrieb Jan Techter <techter at mailbox.tu-berlin.de>: > declare > %unit:test > function local:test-inline-function() { > let $f := function($x) {$x+1} > return unit:assert-equals( $f(5), 6) > };
CG
Christian Grün21 Mar 2014 12:01 #
Thanks for trying. How do you run your test?
Quoted text · Stefan Sechelmann · 41 lines
On Fri, Mar 21, 2014 at 11:55 AM, Stefan Sechelmann <sechel at math.tu-berlin.de> wrote: > I truied, it does not work: > [copy] Copying 21 files to /Users/sechel/workspace/dgdgallery/build/backend/data > DGD Bibtex test suite: > [exec] Improper use? Potential bug? Your feedback is welcome: > [exec] Contact: basex-talk at mailman.uni-konstanz.de > [exec] Version: BaseX 8.0 beta e30d942 > [exec] Java: Oracle Corporation, 1.8.0-ea > [exec] OS: Mac OS X, x86_64 > [exec] Stack Trace: > [exec] java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be cast to org.basex.query.value.type.FuncType > [exec] at org.basex.query.func.Closure.item(Closure.java:275) > [exec] at org.basex.query.func.Closure.value(Closure.java:295) > [exec] at org.basex.query.QueryContext.value(QueryContext.java:407) > [exec] at org.basex.query.gflwor.Let$LetEval.next(Let.java:229) > [exec] at org.basex.query.gflwor.GFLWOR$2.next(GFLWOR.java:74) > > > Stefan Sechelmann > DFG-Forschungszentrum Matheon > Mathematik für Schlüsseltechnologien > Technische Universität Berlin > Sekretariat MA 8-3 Tel. 030/314 29 486 > Straße des 17. Juni 136 Fax 030/314 79 282 > 10623 Berlin sechel at math.tu-berlin.de > http://www.math.tu-berlin.de/~sechel > > Am 20.03.2014 um 18:35 schrieb Jan Techter <techter at mailbox.tu-berlin.de>: > >> declare >> %unit:test >> function local:test-inline-function() { >> let $f := function($x) {$x+1} >> return unit:assert-equals( $f(5), 6) >> }; > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
SS
Stefan Sechelmann21 Mar 2014 12:13 #
Hi Christian,
thank you for looking into this. The test is run from an ant target that uses exec to run a standalone basex instance:
<target name="DGD Bibtex test suite" depends="DGD build backend">
<exec executable="basex/bin/basex" dir="${build-backend-path}" outputproperty="xqunit_bibtex_out" failonerror="true" logerror="true">
<arg value="${build-backend-path}/restxq-test/ajax/bibtex-parser-tests.xq"/>
<arg value="${build-backend-path}/restxq-test/ajax/literature-tests.xq"/>
</exec>
<echo level="info" taskname="xqunit">${xqunit_bibtex_out}</echo>
<condition property="xquery_unit_failure" value="true" else="false">
<or>
<contains string="${xqunit_bibtex_out}" substring="failure line="/>
<contains string="${xqunit_bibtex_out}" substring="error line="/>
</or>
</condition>
<fail if="${xquery_unit_failure}" message="${xqunit_bibtex_out}"/>
</target>The file bibtex-parser-tests.xq is nothing special:
import module namespace bibparse = ‚http://www...
import module namespace data = 'http://www...
declare namespace dgd = 'http://www….
declare namespace bibtex = 'http://...
declare default element namespace ‚http://…
declare
%unit:test
function local:test-inline-function() {
let $f := function($x) {$x+1}
return unit:assert-equals( $f(5), 6)
};… other tests …
unit:test()Best regards
Stefan
Stefan Sechelmann
DFG-Forschungszentrum Matheon
Mathematik für Schlüsseltechnologien
Technische Universität Berlin
Sekretariat MA 8-3 Tel. 030/314 29 486
Straße des 17. Juni 136 Fax 030/314 79 282
10623 Berlin sechel at math.tu-berlin.de
http://www.math.tu-berlin.de/~sechel
Quoted text · Christian Grün · 46 lines
Am 21.03.2014 um 12:01 schrieb Christian Grün <christian.gruen at gmail.com>: > Thanks for trying. How do you run your test? > > > > On Fri, Mar 21, 2014 at 11:55 AM, Stefan Sechelmann > <sechel at math.tu-berlin.de> wrote: >> I truied, it does not work: >> [copy] Copying 21 files to /Users/sechel/workspace/dgdgallery/build/backend/data >> DGD Bibtex test suite: >> [exec] Improper use? Potential bug? Your feedback is welcome: >> [exec] Contact: basex-talk at mailman.uni-konstanz.de >> [exec] Version: BaseX 8.0 beta e30d942 >> [exec] Java: Oracle Corporation, 1.8.0-ea >> [exec] OS: Mac OS X, x86_64 >> [exec] Stack Trace: >> [exec] java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be cast to org.basex.query.value.type.FuncType >> [exec] at org.basex.query.func.Closure.item(Closure.java:275) >> [exec] at org.basex.query.func.Closure.value(Closure.java:295) >> [exec] at org.basex.query.QueryContext.value(QueryContext.java:407) >> [exec] at org.basex.query.gflwor.Let$LetEval.next(Let.java:229) >> [exec] at org.basex.query.gflwor.GFLWOR$2.next(GFLWOR.java:74) >> >> >> Stefan Sechelmann >> DFG-Forschungszentrum Matheon >> Mathematik für Schlüsseltechnologien >> Technische Universität Berlin >> Sekretariat MA 8-3 Tel. 030/314 29 486 >> Straße des 17. Juni 136 Fax 030/314 79 282 >> 10623 Berlin sechel at math.tu-berlin.de >> http://www.math.tu-berlin.de/~sechel >> >> Am 20.03.2014 um 18:35 schrieb Jan Techter <techter at mailbox.tu-berlin.de>: >> >>> declare >>> %unit:test >>> function local:test-inline-function() { >>> let $f := function($x) {$x+1} >>> return unit:assert-equals( $f(5), 6) >>> }; >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
CG
Christian Grün21 Mar 2014 12:18 #
Thanks, this was helpful. It's on our list:
https://github.com/BaseXdb/basex/issues/903
Quoted text · Stefan Sechelmann · 102 lines
On Fri, Mar 21, 2014 at 12:13 PM, Stefan Sechelmann <sechel at math.tu-berlin.de> wrote: > Hi Christian, > thank you for looking into this. The test is run from an ant target that uses > exec to run a standalone basex instance: > > <target name="DGD Bibtex test suite" depends="DGD build backend"> > <exec executable="basex/bin/basex" dir="${build-backend-path}" outputproperty="xqunit_bibtex_out" failonerror="true" logerror="true"> > <arg value="${build-backend-path}/restxq-test/ajax/bibtex-parser-tests.xq"/> > <arg value="${build-backend-path}/restxq-test/ajax/literature-tests.xq"/> > </exec> > <echo level="info" taskname="xqunit">${xqunit_bibtex_out}</echo> > <condition property="xquery_unit_failure" value="true" else="false"> > <or> > <contains string="${xqunit_bibtex_out}" substring="failure line="/> > <contains string="${xqunit_bibtex_out}" substring="error line="/> > </or> > </condition> > <fail if="${xquery_unit_failure}" message="${xqunit_bibtex_out}"/> > </target> > > The file bibtex-parser-tests.xq is nothing special: > > import module namespace bibparse = 'http://www... > import module namespace data = 'http://www... > declare namespace dgd = 'http://www.... > declare namespace bibtex = 'http://... > declare default element namespace 'http://... > > declare > %unit:test > function local:test-inline-function() { > let $f := function($x) {$x+1} > return unit:assert-equals( $f(5), 6) > }; > > ... other tests ... > > unit:test() > > > Best regards > Stefan > > > Stefan Sechelmann > DFG-Forschungszentrum Matheon > Mathematik für Schlüsseltechnologien > Technische Universität Berlin > Sekretariat MA 8-3 Tel. 030/314 29 486 > Straße des 17. Juni 136 Fax 030/314 79 282 > 10623 Berlin sechel at math.tu-berlin.de > http://www.math.tu-berlin.de/~sechel > > Am 21.03.2014 um 12:01 schrieb Christian Grün <christian.gruen at gmail.com>: > >> Thanks for trying. How do you run your test? >> >> >> >> On Fri, Mar 21, 2014 at 11:55 AM, Stefan Sechelmann >> <sechel at math.tu-berlin.de> wrote: >>> I truied, it does not work: >>> [copy] Copying 21 files to /Users/sechel/workspace/dgdgallery/build/backend/data >>> DGD Bibtex test suite: >>> [exec] Improper use? Potential bug? Your feedback is welcome: >>> [exec] Contact: basex-talk at mailman.uni-konstanz.de >>> [exec] Version: BaseX 8.0 beta e30d942 >>> [exec] Java: Oracle Corporation, 1.8.0-ea >>> [exec] OS: Mac OS X, x86_64 >>> [exec] Stack Trace: >>> [exec] java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be cast to org.basex.query.value.type.FuncType >>> [exec] at org.basex.query.func.Closure.item(Closure.java:275) >>> [exec] at org.basex.query.func.Closure.value(Closure.java:295) >>> [exec] at org.basex.query.QueryContext.value(QueryContext.java:407) >>> [exec] at org.basex.query.gflwor.Let$LetEval.next(Let.java:229) >>> [exec] at org.basex.query.gflwor.GFLWOR$2.next(GFLWOR.java:74) >>> >>> >>> Stefan Sechelmann >>> DFG-Forschungszentrum Matheon >>> Mathematik für Schlüsseltechnologien >>> Technische Universität Berlin >>> Sekretariat MA 8-3 Tel. 030/314 29 486 >>> Straße des 17. Juni 136 Fax 030/314 79 282 >>> 10623 Berlin sechel at math.tu-berlin.de >>> http://www.math.tu-berlin.de/~sechel >>> >>> Am 20.03.2014 um 18:35 schrieb Jan Techter <techter at mailbox.tu-berlin.de>: >>> >>>> declare >>>> %unit:test >>>> function local:test-inline-function() { >>>> let $f := function($x) {$x+1} >>>> return unit:assert-equals( $f(5), 6) >>>> }; >>> >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CG
Hi Stefan,
our team member was so kind to fix this issue just in time [1]. A new snapshot is online [2].
You may be interested to hear that we will soon add a BaseX TEST command, which is supposed to replace the XQuery functions. This command will also support updating unit functions.
Best,
Christian
[1] https://github.com/BaseXdb/basex/pull/904
[2] http://files.basex.org/releases/latest/
[3] https://github.com/BaseXdb/basex/issues/903
Quoted text · Stefan Sechelmann · 102 lines
On Fri, Mar 21, 2014 at 12:13 PM, Stefan Sechelmann <sechel at math.tu-berlin.de> wrote: > Hi Christian, > thank you for looking into this. The test is run from an ant target that uses > exec to run a standalone basex instance: > > <target name="DGD Bibtex test suite" depends="DGD build backend"> > <exec executable="basex/bin/basex" dir="${build-backend-path}" outputproperty="xqunit_bibtex_out" failonerror="true" logerror="true"> > <arg value="${build-backend-path}/restxq-test/ajax/bibtex-parser-tests.xq"/> > <arg value="${build-backend-path}/restxq-test/ajax/literature-tests.xq"/> > </exec> > <echo level="info" taskname="xqunit">${xqunit_bibtex_out}</echo> > <condition property="xquery_unit_failure" value="true" else="false"> > <or> > <contains string="${xqunit_bibtex_out}" substring="failure line="/> > <contains string="${xqunit_bibtex_out}" substring="error line="/> > </or> > </condition> > <fail if="${xquery_unit_failure}" message="${xqunit_bibtex_out}"/> > </target> > > The file bibtex-parser-tests.xq is nothing special: > > import module namespace bibparse = 'http://www... > import module namespace data = 'http://www... > declare namespace dgd = 'http://www.... > declare namespace bibtex = 'http://... > declare default element namespace 'http://... > > declare > %unit:test > function local:test-inline-function() { > let $f := function($x) {$x+1} > return unit:assert-equals( $f(5), 6) > }; > > ... other tests ... > > unit:test() > > > Best regards > Stefan > > > Stefan Sechelmann > DFG-Forschungszentrum Matheon > Mathematik für Schlüsseltechnologien > Technische Universität Berlin > Sekretariat MA 8-3 Tel. 030/314 29 486 > Straße des 17. Juni 136 Fax 030/314 79 282 > 10623 Berlin sechel at math.tu-berlin.de > http://www.math.tu-berlin.de/~sechel > > Am 21.03.2014 um 12:01 schrieb Christian Grün <christian.gruen at gmail.com>: > >> Thanks for trying. How do you run your test? >> >> >> >> On Fri, Mar 21, 2014 at 11:55 AM, Stefan Sechelmann >> <sechel at math.tu-berlin.de> wrote: >>> I truied, it does not work: >>> [copy] Copying 21 files to /Users/sechel/workspace/dgdgallery/build/backend/data >>> DGD Bibtex test suite: >>> [exec] Improper use? Potential bug? Your feedback is welcome: >>> [exec] Contact: basex-talk at mailman.uni-konstanz.de >>> [exec] Version: BaseX 8.0 beta e30d942 >>> [exec] Java: Oracle Corporation, 1.8.0-ea >>> [exec] OS: Mac OS X, x86_64 >>> [exec] Stack Trace: >>> [exec] java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be cast to org.basex.query.value.type.FuncType >>> [exec] at org.basex.query.func.Closure.item(Closure.java:275) >>> [exec] at org.basex.query.func.Closure.value(Closure.java:295) >>> [exec] at org.basex.query.QueryContext.value(QueryContext.java:407) >>> [exec] at org.basex.query.gflwor.Let$LetEval.next(Let.java:229) >>> [exec] at org.basex.query.gflwor.GFLWOR$2.next(GFLWOR.java:74) >>> >>> >>> Stefan Sechelmann >>> DFG-Forschungszentrum Matheon >>> Mathematik für Schlüsseltechnologien >>> Technische Universität Berlin >>> Sekretariat MA 8-3 Tel. 030/314 29 486 >>> Straße des 17. Juni 136 Fax 030/314 79 282 >>> 10623 Berlin sechel at math.tu-berlin.de >>> http://www.math.tu-berlin.de/~sechel >>> >>> Am 20.03.2014 um 18:35 schrieb Jan Techter <techter at mailbox.tu-berlin.de>: >>> >>>> declare >>>> %unit:test >>>> function local:test-inline-function() { >>>> let $f := function($x) {$x+1} >>>> return unit:assert-equals( $f(5), 6) >>>> }; >>> >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
SS
Stefan Sechelmann25 Mar 2014 15:20 #
Hi Christian,
thanks for your effort. However after an update to commit 78470f32 which includes the fix to GH-903 I get the following exception on any test, which seems to be connected to the compilation issue: [exec] Improper use? Potential bug? Your feedback is welcome: [exec] Contact: basex-talk at mailman.uni-konstanz.de
[exec] Version: BaseX 8.0 beta 78470f3
[exec] Java: Oracle Corporation, 1.8.0-ea
[exec] OS: Mac OS X, x86_64
[exec] Stack Trace:
[exec] java.lang.NullPointerException
[exec] at org.basex.query.func.FNUnit.opt(FNUnit.java:53) [exec] at org.basex.query.func.StandardFunc.optimize(StandardFunc.java:69) [exec] at org.basex.query.func.StandardFunc.compile(StandardFunc.java:62) [exec] at org.basex.query.MainModule.compile(MainModule.java:62) [exec] at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114) [exec] at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105) [exec] at org.basex.query.QueryContext.analyze(QueryContext.java:318) [exec] at org.basex.query.QueryContext.compile(QueryContext.java:307) [exec] at org.basex.query.QueryProcessor.compile(QueryProcessor.java:71) [exec] at org.basex.core.cmd.AQuery.query(AQuery.java:73) [exec] at org.basex.core.cmd.XQuery.run(XQuery.java:22) [exec] at org.basex.core.Command.run(Command.java:329) [exec] at org.basex.core.Command.execute(Command.java:94) [exec] at org.basex.server.LocalSession.execute(LocalSession.java:121) [exec] at org.basex.server.Session.execute(Session.java:37) [exec] at org.basex.core.Main.execute(Main.java:146)
[exec] at org.basex.BaseX.<init>(BaseX.java:119)
[exec] at org.basex.BaseX.main(BaseX.java:38)
Stefan Sechelmann
DFG-Forschungszentrum Matheon
Mathematik für Schlüsseltechnologien
Technische Universität Berlin
Sekretariat MA 8-3 Tel. 030/314 29 486
Straße des 17. Juni 136 Fax 030/314 79 282
10623 Berlin sechel at math.tu-berlin.de
http://www.math.tu-berlin.de/~sechel
Quoted text · Christian Grün · 120 lines
Am 21.03.2014 um 16:21 schrieb Christian Grün <christian.gruen at gmail.com>: > Hi Stefan, > > our team member was so kind to fix this issue just in time [1]. A new > snapshot is online [2]. > > You may be interested to hear that we will soon add a BaseX TEST > command, which is supposed to replace the XQuery functions. This > command will also support updating unit functions. > > Best, > Christian > > [1] https://github.com/BaseXdb/basex/pull/904 > [2] http://files.basex.org/releases/latest/ > [3] https://github.com/BaseXdb/basex/issues/903 > > > On Fri, Mar 21, 2014 at 12:13 PM, Stefan Sechelmann > <sechel at math.tu-berlin.de> wrote: >> Hi Christian, >> thank you for looking into this. The test is run from an ant target that uses >> exec to run a standalone basex instance: >> >> <target name="DGD Bibtex test suite" depends="DGD build backend"> >> <exec executable="basex/bin/basex" dir="${build-backend-path}" outputproperty="xqunit_bibtex_out" failonerror="true" logerror="true"> >> <arg value="${build-backend-path}/restxq-test/ajax/bibtex-parser-tests.xq"/> >> <arg value="${build-backend-path}/restxq-test/ajax/literature-tests.xq"/> >> </exec> >> <echo level="info" taskname="xqunit">${xqunit_bibtex_out}</echo> >> <condition property="xquery_unit_failure" value="true" else="false"> >> <or> >> <contains string="${xqunit_bibtex_out}" substring="failure line="/> >> <contains string="${xqunit_bibtex_out}" substring="error line="/> >> </or> >> </condition> >> <fail if="${xquery_unit_failure}" message="${xqunit_bibtex_out}"/> >> </target> >> >> The file bibtex-parser-tests.xq is nothing special: >> >> import module namespace bibparse = 'http://www... >> import module namespace data = 'http://www... >> declare namespace dgd = 'http://www.... >> declare namespace bibtex = 'http://... >> declare default element namespace 'http://... >> >> declare >> %unit:test >> function local:test-inline-function() { >> let $f := function($x) {$x+1} >> return unit:assert-equals( $f(5), 6) >> }; >> >> ... other tests ... >> >> unit:test() >> >> >> Best regards >> Stefan >> >> >> Stefan Sechelmann >> DFG-Forschungszentrum Matheon >> Mathematik für Schlüsseltechnologien >> Technische Universität Berlin >> Sekretariat MA 8-3 Tel. 030/314 29 486 >> Straße des 17. Juni 136 Fax 030/314 79 282 >> 10623 Berlin sechel at math.tu-berlin.de >> http://www.math.tu-berlin.de/~sechel >> >> Am 21.03.2014 um 12:01 schrieb Christian Grün <christian.gruen at gmail.com>: >> >>> Thanks for trying. How do you run your test? >>> >>> >>> >>> On Fri, Mar 21, 2014 at 11:55 AM, Stefan Sechelmann >>> <sechel at math.tu-berlin.de> wrote: >>>> I truied, it does not work: >>>> [copy] Copying 21 files to /Users/sechel/workspace/dgdgallery/build/backend/data >>>> DGD Bibtex test suite: >>>> [exec] Improper use? Potential bug? Your feedback is welcome: >>>> [exec] Contact: basex-talk at mailman.uni-konstanz.de >>>> [exec] Version: BaseX 8.0 beta e30d942 >>>> [exec] Java: Oracle Corporation, 1.8.0-ea >>>> [exec] OS: Mac OS X, x86_64 >>>> [exec] Stack Trace: >>>> [exec] java.lang.ClassCastException: org.basex.query.value.type.AtomType cannot be cast to org.basex.query.value.type.FuncType >>>> [exec] at org.basex.query.func.Closure.item(Closure.java:275) >>>> [exec] at org.basex.query.func.Closure.value(Closure.java:295) >>>> [exec] at org.basex.query.QueryContext.value(QueryContext.java:407) >>>> [exec] at org.basex.query.gflwor.Let$LetEval.next(Let.java:229) >>>> [exec] at org.basex.query.gflwor.GFLWOR$2.next(GFLWOR.java:74) >>>> >>>> >>>> Stefan Sechelmann >>>> DFG-Forschungszentrum Matheon >>>> Mathematik für Schlüsseltechnologien >>>> Technische Universität Berlin >>>> Sekretariat MA 8-3 Tel. 030/314 29 486 >>>> Straße des 17. Juni 136 Fax 030/314 79 282 >>>> 10623 Berlin sechel at math.tu-berlin.de >>>> http://www.math.tu-berlin.de/~sechel >>>> >>>> Am 20.03.2014 um 18:35 schrieb Jan Techter <techter at mailbox.tu-berlin.de>: >>>> >>>>> declare >>>>> %unit:test >>>>> function local:test-inline-function() { >>>>> let $f := function($x) {$x+1} >>>>> return unit:assert-equals( $f(5), 6) >>>>> }; >>>> >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>
LW
Leo Wörteler25 Mar 2014 15:50 #
Hi Stefan,
Quoted text · Stefan Sechelmann · 3 lines
Am 25.03.2014 15:20, schrieb Stefan Sechelmann: > thanks for your effort. However after an update to commit 78470f32 which includes the > fix to GH-903 I get the following exception on any test, which seems to be connected to the compilation issue:
[...]
Quoted text · Stefan Sechelmann · 3 lines
> [exec] java.lang.NullPointerException > [exec] at org.basex.query.func.FNUnit.opt(FNUnit.java:53) > [exec] at org.basex.query.func.StandardFunc.optimize(StandardFunc.java:69)
that is a silly regression I introduced when fixing the previous bug. I submitted a pull request [1], so it should be fixed as soon as Christan finds the time to review and merge it.
Cheers and sorry for the inconvenience,
Leo
[1] https://github.com/BaseXdb/basex/pull/912
CG
Christian Grün25 Mar 2014 16:01 #
Quoted text · Leo Wörteler · 3 lines
> that is a silly regression I introduced when fixing the previous bug. I > submitted a pull request [1], so it should be fixed as soon as Christan > finds the time to review and merge it.
...done; thanks for the fix!
Christian
Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery