-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add initial tests for rendering of bibliography entries
- Loading branch information
1 parent
166d25f
commit 36a8779
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
xquery version "3.1"; | ||
|
||
module namespace bt="http://weber-gesamtausgabe.de/xqsuite/biblio-tests"; | ||
|
||
declare namespace tei="http://www.tei-c.org/ns/1.0"; | ||
declare namespace test="http://exist-db.org/xquery/xqsuite"; | ||
declare namespace xhtml="http://www.w3.org/1999/xhtml"; | ||
|
||
import module namespace crud="http://xquery.weber-gesamtausgabe.de/modules/crud" at "xmldb:exist:///db/apps/WeGA-WebApp/modules/crud.xqm"; | ||
import module namespace bibl="http://xquery.weber-gesamtausgabe.de/modules/bibl" at "xmldb:exist:///db/apps/WeGA-WebApp/modules/bibl.xqm"; | ||
|
||
declare | ||
%test:args('A113127') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='author'>Johann Evangelist Engl</xhtml:span>") | ||
%test:args('A111355') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='author'>Lucy Poate Stebbins</xhtml:span>", "<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='author'>Richard Poate Stebbins</xhtml:span>") | ||
%test:args('A110130') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='author'>Dagmar Beck</xhtml:span>", "<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='author'>Joachim Veit</xhtml:span>", "<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='author'>Frank Ziegler</xhtml:span>") | ||
function bt:test-authors($a as xs:string) as element()+ { | ||
let $doc := crud:doc($a) | ||
return | ||
bibl:printCitation($doc/tei:biblStruct, <xhtml:div/>, 'de')//xhtml:span[@class='author'] | ||
}; | ||
|
||
declare | ||
%test:args('A111355') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='title'>Enchanted Wanderer. The Life of Carl Maria von Weber</xhtml:span>") | ||
%test:args('A111377') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='title'>Die Beziehungen Carl Maria v. Webers zu thüringischen Musikern</xhtml:span>") | ||
%test:args('A111038') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='title'>„… wer Flöte bläst, kauft doch allemahl von meinen Werken“. Anton Bernhard Fürstenaus Briefkontakte zum Verlag B. Schott’s Söhne zwischen 1819 und 1825</xhtml:span>") | ||
%test:args('A111057') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='title'>Die Rezeption von Carl Maria von Webers „Der Freischütz“ als deutsche Nationaloper. <xhtml:a href='https://doi.org/10.25365/thesis.25680'>Diplomarbeit <xhtml:i class='fa fa-external-link' aria-hidden='true'/></xhtml:a> zum Magistra der Philosophie (Mag. phil.) an der Universität Wien</xhtml:span>") | ||
%test:args('A111055') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='title'>Das <xhtml:span class='tei_hi_italic'>Freischütz</xhtml:span>-Libretto: Quellensituation und intertextuelle Referenzen</xhtml:span>") | ||
function bt:test-title($a as xs:string) as element()+ { | ||
let $doc := crud:doc($a) | ||
return | ||
bibl:printCitation($doc/tei:biblStruct, <xhtml:div/>, 'de')//xhtml:span[@class='title'] | ||
}; | ||
|
||
declare | ||
%test:args('A111377') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='journalTitle'>Das Thüringer Fähnlein. Monatshefte für die mitteldeutsche Heimat</xhtml:span>") | ||
function bt:test-journalTitle($a as xs:string) as element() { | ||
let $doc := crud:doc($a) | ||
return | ||
bibl:printCitation($doc/tei:biblStruct, <xhtml:div/>, 'de')//xhtml:span[@class='journalTitle'] | ||
}; | ||
|
||
declare | ||
%test:args('A111038') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='collectionTitle'>„Ei, dem alten Herrn zoll’ ich Achtung gern’“. Festschrift für Joachim Veit zum 60. Geburtstag</xhtml:span>") | ||
%test:args('A110745') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='collectionTitle'>Genie, Irrsinn und Ruhm. Die Komponisten<xhtml:span class='edition'>, 7. völlig neu bearb. Auflage</xhtml:span></xhtml:span>") | ||
function bt:test-collectionTitle($a as xs:string) as element() { | ||
let $doc := crud:doc($a) | ||
return | ||
bibl:printCitation($doc/tei:biblStruct, <xhtml:div/>, 'de')//xhtml:span[@class='collectionTitle'] | ||
}; | ||
|
||
declare | ||
%test:args('A111038') %test:assertEquals("„Ei, dem alten Herrn zoll’ ich Achtung gern’“. Festschrift für Joachim Veit zum 60. Geburtstag (2016), S. 89–99") | ||
%test:args('A113127') %test:assertEquals("Salzburger Volksblatt, Jg. 28, Nr. 95 (28. April 1898), [S. 3]") | ||
%test:args('A110998') %test:assertEquals("Schlesien. Eine Vierteljahresschrift für Kunst, Wissenschaft und Volkstum, Jg. 19 (1974), Nr. 3, S. 158–162") | ||
function bt:test-printJournalCitation($a as xs:string) as xs:string { | ||
let $doc := crud:doc($a) | ||
return | ||
bibl:printJournalCitation($doc/tei:biblStruct/tei:monogr, <xhtml:span/>, 'de') | ||
}; | ||
|
||
declare | ||
%test:args('A112279') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='placeNYear'>Leipzig <xhtml:sup>2</xhtml:sup>1865</xhtml:span>") | ||
%test:args('A111825') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='placeNYear'>München 1915</xhtml:span>") | ||
%test:args('A110159') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='placeNYear'>Stuttgart &amp; Weimar 2002</xhtml:span>") | ||
%test:args('A110046') %test:assertEquals("<xhtml:span xmlns:xhtml='http://www.w3.org/1999/xhtml' class='placeNYear'>Köln, Weimar &amp; Wien 2008</xhtml:span>") | ||
function bt:test-placeNYear($a as xs:string) as element() { | ||
let $doc := crud:doc($a) | ||
return | ||
bibl:printCitation($doc/tei:biblStruct, <xhtml:div/>, 'de')//xhtml:span[@class='placeNYear'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
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"; | ||
import module namespace dt="http://xquery.weber-gesamtausgabe.de/modules/date-tests" at "date-tests.xqm"; | ||
import module namespace st="http://xquery.weber-gesamtausgabe.de/modules/str-tests" at "str-tests.xqm"; | ||
import module namespace mt="http://xquery.weber-gesamtausgabe.de/modules/math-tests" at "math-tests.xqm"; | ||
import module namespace geot="http://xquery.weber-gesamtausgabe.de/modules/geo-tests" at "geo-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://weber-gesamtausgabe.de/xqsuite/biblio-tests") | ||
)) |