From b593ecdd3486f4541c0bcd68beec9146d78813a2 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Wed, 1 Apr 2015 23:34:18 +0200 Subject: 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 --- .../integration/user_defined_syntax/poem.in.osml | 65 ++++++++++++++++++++++ .../integration/user_defined_syntax/poem.out.osxml | 44 +++++++++++++++ .../user_defined_syntax/simple_short_token.in.osml | 17 ++++++ .../simple_short_token.out.osxml | 6 ++ .../user_defined_syntax/wikilike.in.osml | 62 +++++++++++++++++++++ .../user_defined_syntax/wikilike.out.osxml | 51 +++++++++++++++++ 6 files changed, 245 insertions(+) create mode 100644 testdata/integration/user_defined_syntax/poem.in.osml create mode 100644 testdata/integration/user_defined_syntax/poem.out.osxml create mode 100644 testdata/integration/user_defined_syntax/simple_short_token.in.osml create mode 100644 testdata/integration/user_defined_syntax/simple_short_token.out.osxml create mode 100644 testdata/integration/user_defined_syntax/wikilike.in.osml create mode 100644 testdata/integration/user_defined_syntax/wikilike.out.osxml (limited to 'testdata') 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 @@ + + + + + + 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; + + + 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 @@ + + + + + + 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. + +<>, 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 @@ + + + + + == 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! + + + -- cgit v1.2.3