diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-04-01 23:34:18 +0200 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2016-04-25 22:19:29 +0200 |
commit | b593ecdd3486f4541c0bcd68beec9146d78813a2 (patch) | |
tree | e94a9429f90298119474516f22a28eb0afb99d3b /testdata | |
parent | e03ab48ced82a1eddd3e99b6c34ed6dc617af0f6 (diff) |
Add first integration tests
* "poem" contains a nice use case for user defined syntax that still needs to be implemented (indent and dedent as open/close tag)
* "simple_short_token" triggers a non-deterministic bug that is not caught by valgrind
* "wikilike" contains various user defined syntax tests as well as the not yet implemented per-field user defined syntax
Diffstat (limited to 'testdata')
6 files changed, 245 insertions, 0 deletions
diff --git a/testdata/integration/user_defined_syntax/poem.in.osml b/testdata/integration/user_defined_syntax/poem.in.osml new file mode 100644 index 0000000..f0deaba --- /dev/null +++ b/testdata/integration/user_defined_syntax/poem.in.osml @@ -0,0 +1,65 @@ +\begin{document} + +\ontology#poem{ + \struct#poem[root=true] + \field + \childRef[ref=stanza] + \struct#stanza[transparent=true] + \syntax + \close{\paragraph} + \field + \childRef[ref=line] + \childRef[ref=indentation] + \struct#line[transparent=true] + \syntax + \close{\newline} + \primitive[type=string] + \struct#indentation + \syntax +% TODO: Fix this +% \open{\indent} +% \close{\dedent} + \field + \childRef[ref=line] + \childRef[ref=indentation] +} + +% To Autumn by John Keats (1820) +% http://en.wikisource.org/wiki/Keats;_poems_published_in_1820/To_Autumn +\begin{poem} +Among the river sallows, borne aloft + Or sinking as the light wind lives or dies; +And full-grown lambs loud bleat from hilly bourn; + Hedge-crickets sing; and now with treble soft + The red-breast whistles from a garden-croft; + And gathering swallows twitter in the skies. +Season of mists and mellow fruitfulness, + Close bosom-friend of the maturing sun; +Conspiring with him how to load and bless + With fruit the vines that round the thatch-eves run; +To bend with apples the moss'd cottage-trees, + And fill all fruit with ripeness to the core; + To swell the gourd, and plump the hazel shells +With a sweet kernel; to set budding more, + And still more, later flowers for the bees, + Until they think warm days will never cease, + For Summer has o'er-brimm'd their clammy cells. + +Who hath not seen thee oft amid thy store? + Sometimes whoever seeks abroad may find +Thee sitting careless on a granary floor, + Thy hair soft-lifted by the winnowing wind; +Or on a half-reap'd furrow sound asleep, + Drows'd with the fume of poppies, while thy hook + Spares the next swath and all its twined flowers: +And sometimes like a gleaner thou dost keep + Steady thy laden head across a brook; + Or by a cyder-press, with patient look, + Thou watchest the last oozings hours by hours. + +Where are the songs of Spring? Ay, where are they? + Think not of them, thou hast thy music too,— +While barred clouds bloom the soft-dying day, + And touch the stubble-plains with rosy hue; +\end{poem} +\end{document} diff --git a/testdata/integration/user_defined_syntax/poem.out.osxml b/testdata/integration/user_defined_syntax/poem.out.osxml new file mode 100644 index 0000000..6fe448d --- /dev/null +++ b/testdata/integration/user_defined_syntax/poem.out.osxml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<document xmlns:poem="poem"> + <import rel="ontology" src="/home/andreas/source/ousia-src/testdata/integration/user_defined_syntax/poem.in.osml"/> + <poem:poem> + <poem:stanza> + <poem:line>Among the river sallows, borne aloft</poem:line> + <poem:line>Or sinking as the light wind lives or dies;</poem:line> + <poem:line>And full-grown lambs loud bleat from hilly bourn;</poem:line> + <poem:line>Hedge-crickets sing; and now with treble soft</poem:line> + <poem:line>The red-breast whistles from a garden-croft;</poem:line> + <poem:line>And gathering swallows twitter in the skies.</poem:line> + <poem:line>Season of mists and mellow fruitfulness,</poem:line> + <poem:line>Close bosom-friend of the maturing sun;</poem:line> + <poem:line>Conspiring with him how to load and bless</poem:line> + <poem:line>With fruit the vines that round the thatch-eves run;</poem:line> + <poem:line>To bend with apples the moss'd cottage-trees,</poem:line> + <poem:line>And fill all fruit with ripeness to the core;</poem:line> + <poem:line>To swell the gourd, and plump the hazel shells</poem:line> + <poem:line>With a sweet kernel; to set budding more,</poem:line> + <poem:line>And still more, later flowers for the bees,</poem:line> + <poem:line>Until they think warm days will never cease,</poem:line> + <poem:line>For Summer has o'er-brimm'd their clammy cells.</poem:line> + </poem:stanza> + <poem:stanza> + <poem:line>Who hath not seen thee oft amid thy store?</poem:line> + <poem:line>Sometimes whoever seeks abroad may find</poem:line> + <poem:line>Thee sitting careless on a granary floor,</poem:line> + <poem:line>Thy hair soft-lifted by the winnowing wind;</poem:line> + <poem:line>Or on a half-reap'd furrow sound asleep,</poem:line> + <poem:line>Drows'd with the fume of poppies, while thy hook</poem:line> + <poem:line>Spares the next swath and all its twined flowers:</poem:line> + <poem:line>And sometimes like a gleaner thou dost keep</poem:line> + <poem:line>Steady thy laden head across a brook;</poem:line> + <poem:line>Or by a cyder-press, with patient look,</poem:line> + <poem:line>Thou watchest the last oozings hours by hours.</poem:line> + </poem:stanza> + <poem:stanza> + <poem:line>Where are the songs of Spring? Ay, where are they?</poem:line> + <poem:line>Think not of them, thou hast thy music too,—</poem:line> + <poem:line>While barred clouds bloom the soft-dying day,</poem:line> + <poem:line>And touch the stubble-plains with rosy hue;</poem:line> + </poem:stanza> + </poem:poem> +</document> diff --git a/testdata/integration/user_defined_syntax/simple_short_token.in.osml b/testdata/integration/user_defined_syntax/simple_short_token.in.osml new file mode 100644 index 0000000..ef12a98 --- /dev/null +++ b/testdata/integration/user_defined_syntax/simple_short_token.in.osml @@ -0,0 +1,17 @@ +\document +\ontology#test{ + \struct#a[root=true] + \field + \childRef[ref=b] + \childRef[ref=c] + \struct#b + \syntax + \short{!=} + \struct#c + \syntax + \short{=} +} + +\begin{a} += +\end{a} diff --git a/testdata/integration/user_defined_syntax/simple_short_token.out.osxml b/testdata/integration/user_defined_syntax/simple_short_token.out.osxml new file mode 100644 index 0000000..743e927 --- /dev/null +++ b/testdata/integration/user_defined_syntax/simple_short_token.out.osxml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<document xmlns:test="test"> + <test:a> + <test:c/> + </test:a> +</document> diff --git a/testdata/integration/user_defined_syntax/wikilike.in.osml b/testdata/integration/user_defined_syntax/wikilike.in.osml new file mode 100644 index 0000000..9bc80c7 --- /dev/null +++ b/testdata/integration/user_defined_syntax/wikilike.in.osml @@ -0,0 +1,62 @@ +\begin{document} + +\ontology#book{ + \struct#book[root=true] + \field + \childRef[ref=section] + \childRef[ref=paragraph] + \struct#section + \primitive#title[type=string,subtree=true] + \syntax + \open{==} + \close{==} + \field + \childRef[ref=paragraph] + \struct#paragraph[transparent=true] + \syntax + \close{\paragraph} + \field + \childRef[ref=text] + \childRef[ref=code] + \childRef[ref=speech] + \childRef[ref=thought] + \struct#code + \syntax + \open{`} + \close{`} + \field + \childRef[ref=text] + \struct#speech + \syntax + \open{<<} + \close{>>} + \fieldRef[ref=paragraph.$default] + \struct#text[transparent=true] + \primitive[type=string] + \struct#thought + \syntax + \short{--} +} + +\begin{book} +== This tests somewhat plays with user defined syntax == + +As you -- surely -- can see, just the tiny `\\syntax` definitions above make writing documents +much easier. + +For instance, this is a new paragraph. + +And here goes another one. + +All with the power of just adding `\\close\{\\paragraph\}` to the `\\syntax` +definition of the paragraph structure. + +<<Well, that's insane!>>, I hear you say. Right so! This indeed is insane. + +== One last thing == + +Did you notice how we started sections here? + +Sections can be allowed to use Wiki-like syntax with only three lines of code. Awesome! +\end{book} +\end{document} diff --git a/testdata/integration/user_defined_syntax/wikilike.out.osxml b/testdata/integration/user_defined_syntax/wikilike.out.osxml new file mode 100644 index 0000000..7545997 --- /dev/null +++ b/testdata/integration/user_defined_syntax/wikilike.out.osxml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<document xmlns:book="book"> + <book:book> + <book:paragraph> + <book:text>== This tests somewhat plays with user defined syntax ==</book:text> + </book:paragraph> + <book:paragraph> + <book:text>As you</book:text> + <book:thought/> + <book:text>surely</book:text> + <book:thought/> + <book:text>can see, just the tiny</book:text> + <book:code> + <book:text>\syntax</book:text> + </book:code> + <book:text>definitions above make writing documents much easier.</book:text> + </book:paragraph> + <book:paragraph> + <book:text>For instance, this is a new paragraph.</book:text> + </book:paragraph> + <book:paragraph> + <book:text>And here goes another one.</book:text> + </book:paragraph> + <book:paragraph> + <book:text>All with the power of just adding</book:text> + <book:code> + <book:text>\close{\paragraph}</book:text> + </book:code> + <book:text>to the</book:text> + <book:code> + <book:text>\syntax</book:text> + </book:code> + <book:text>definition of the paragraph structure.</book:text> + </book:paragraph> + <book:paragraph> + <book:speech> + <book:text>Well, that's insane!</book:text> + </book:speech> + <book:text>, I hear you say. Right so! This indeed is insane.</book:text> + </book:paragraph> + <book:paragraph> + <book:text>== One last thing ==</book:text> + </book:paragraph> + <book:paragraph> + <book:text>Did you notice how we started sections here?</book:text> + </book:paragraph> + <book:paragraph> + <book:text>Sections can be allowed to use Wiki-like syntax with only three lines of code. Awesome!</book:text> + </book:paragraph> + </book:book> +</document> |