Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WeGA-WebApp-lib
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
busoni-schriften
WeGA-WebApp-lib
Commits
abbcac6e
Commit
abbcac6e
authored
7 years ago
by
Peter Stadler
Browse files
Options
Downloads
Patches
Plain Diff
added first unit tests
parent
2b1630ef
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
testing/run-tests.xql
+9
-0
9 additions, 0 deletions
testing/run-tests.xql
testing/wega-util-shared-tests.xqm
+99
-0
99 additions, 0 deletions
testing/wega-util-shared-tests.xqm
with
108 additions
and
0 deletions
testing/run-tests.xql
0 → 100644
+
9
−
0
View file @
abbcac6e
xquery version "3.1";
(: the following line must be added to each of the modules that include unit tests :)
import module namespace test="http://exist-db.org/xquery/xqsuite" at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql";
import module namespace wust="http://xquery.weber-gesamtausgabe.de/modules/wega-util-shared-tests" at "wega-util-shared-tests.xqm";
(: the test:suite() function will run all the test-annotated functions in the module whose namespace URI you provide :)
test:suite(util:list-functions("http://xquery.weber-gesamtausgabe.de/modules/wega-util-shared-tests"))
This diff is collapsed.
Click to expand it.
testing/wega-util-shared-tests.xqm
0 → 100644
+
99
−
0
View file @
abbcac6e
xquery
version
"3.1"
;
module
namespace
wust
=
"http://xquery.weber-gesamtausgabe.de/modules/wega-util-shared-tests"
;
declare
namespace
test
=
"http://exist-db.org/xquery/xqsuite"
;
import
module
namespace
wega-util-shared
=
"http://xquery.weber-gesamtausgabe.de/modules/wega-util-shared"
at
"../xquery/wega-util-shared.xqm"
;
declare
%test:assertFalse
function
wust:test-has-content-empty-string
()
as
xs:boolean
{
wega-util-shared:has-content
(
''
)
or
wega-util-shared:has-content
(
' '
)
};
declare
%test:assertFalse
function
wust:test-has-content-empty-sequence
()
as
xs:boolean
{
wega-util-shared:has-content
(())
};
declare
%test:assertTrue
function
wust:test-has-content-string
()
as
xs:boolean
{
wega-util-shared:has-content
(
'foo'
)
and
wega-util-shared:has-content
((
'foo'
,
''
))
};
declare
%test:assertTrue
function
wust:test-has-content-number
()
as
xs:boolean
{
wega-util-shared:has-content
(
4
)
and
wega-util-shared:has-content
(
4.2
)
and
wega-util-shared:has-content
(
-
4
)
and
wega-util-shared:has-content
(
-
4.2
)
and
wega-util-shared:has-content
((
3
,
2
,
0
))
and
wega-util-shared:has-content
((
3.7
,
2.7
,
0
))
and
wega-util-shared:has-content
(
xs:double
(
'INF'
))
and
wega-util-shared:has-content
(
xs:double
(
'-INF'
))
};
declare
%test:assertFalse
function
wust:test-has-content-zeroNaN
()
as
xs:boolean
{
wega-util-shared:has-content
(
0
)
or
wega-util-shared:has-content
(
xs:double
(
'NaN'
))
};
declare
%test:assertFalse
function
wust:test-has-content-empty-map
()
as
xs:boolean
{
wega-util-shared:has-content
(
map
{
'foo'
:
()})
or
wega-util-shared:has-content
(
map
{})
};
declare
%test:assertTrue
function
wust:test-has-content-map
()
as
xs:boolean
{
wega-util-shared:has-content
(
map
{
'foo'
:
'bar'
})
and
wega-util-shared:has-content
(
map
{
'foo'
:
()
,
'foo'
:
'bar'
})
};
declare
%test:assertTrue
function
wust:test-has-content-function
()
as
xs:boolean
{
wega-util-shared:has-content
(
function
()
{
'foo'
})
};
declare
%test:assertFalse
function
wust:test-has-content-empty-array
()
as
xs:boolean
{
wega-util-shared:has-content
([])
or
wega-util-shared:has-content
([()])
or
wega-util-shared:has-content
([
''
])
};
declare
%test:assertTrue
function
wust:test-has-content-array
()
as
xs:boolean
{
wega-util-shared:has-content
([
'a'
])
and
wega-util-shared:has-content
([
4
])
and
wega-util-shared:has-content
([
map
{
'foo'
:
'bar'
}])
and
wega-util-shared:has-content
([
'a'
,
''
])
};
declare
%test:assertFalse
function
wust:test-has-content-empty-attribute
()
as
xs:boolean
{
let
$nodeA
:=
<a
href=
""
/>
let
$nodeB
:=
<a
href=
" "
/>
let
$nodeC
:=
<a
href=
"0"
/>
let
$nodeD
:=
<a
href=
"NaN"
/>
return
wega-util-shared:has-content
(
$nodeA
/
@href
)
or
wega-util-shared:has-content
(
$nodeB
/
@href
)
or
wega-util-shared:has-content
(
$nodeA
/
@foo
)
or
wega-util-shared:has-content
(
$nodeC
/
@href
)
or
wega-util-shared:has-content
(
$nodeD
/
@href
)
};
declare
%test:assertTrue
function
wust:test-has-content-attribute
()
as
xs:boolean
{
let
$node
:=
<a
href=
"foo"
/>
return
wega-util-shared:has-content
(
$node
/
@href
)
};
declare
%test:assertFalse
function
wust:test-has-content-empty-element
()
as
xs:boolean
{
wega-util-shared:has-content
(
<a/>
)
or
wega-util-shared:has-content
(
<a></a>
)
or
wega-util-shared:has-content
(
<a>
</a>
)
or
wega-util-shared:has-content
(
element
a
{
' '
})
or
wega-util-shared:has-content
(
<a
href=
"foo"
/>
)
or
wega-util-shared:has-content
(
<a>
0
</a>
)
or
wega-util-shared:has-content
(
<a>
NaN
</a>
)
};
declare
%test:assertTrue
function
wust:test-has-content-element
()
as
xs:boolean
{
wega-util-shared:has-content
(
<a>
foo
</a>
)
and
wega-util-shared:has-content
(
<a>
foo
bar
</a>
)
and
wega-util-shared:has-content
(
<a>
0
0
</a>
)
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment