diff options
author | John Mayhew | 2012-05-07 16:30:19 -0700 |
---|---|---|
committer | John Mayhew | 2012-05-07 16:30:19 -0700 |
commit | db4ba95f50148198759dde503ec1c778184d9dbe (patch) | |
tree | 8b79ad58108af2f17d15abc8cdc33d35229ab20d /imports/codemirror/mode/xquery/test/testBase.js | |
parent | 843d8ea8ee58a54bcb71d7b28dbf78fae153b491 (diff) | |
parent | 526e423e4a2734c2b139af23911e912452a4443f (diff) | |
download | ninja-db4ba95f50148198759dde503ec1c778184d9dbe.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts:
js/components/layout/tools-list.reel/tools-list.html
js/components/layout/tools-properties.reel/tools-properties.html
js/components/tools-properties/brush-properties.reel/brush-properties.html
js/components/tools-properties/fill-properties.reel/fill-properties.html
js/components/tools-properties/pen-properties.reel/pen-properties.html
js/components/tools-properties/pencil-properties.reel/pencil-properties.html
js/components/tools-properties/selection-properties.reel/selection-properties.html
js/components/tools-properties/shape-properties.reel/shape-properties.html
js/components/tools-properties/tag-properties.reel/tag-properties.html
js/components/tools-properties/text-properties.reel/text-properties.html
Diffstat (limited to 'imports/codemirror/mode/xquery/test/testBase.js')
-rw-r--r-- | imports/codemirror/mode/xquery/test/testBase.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/imports/codemirror/mode/xquery/test/testBase.js b/imports/codemirror/mode/xquery/test/testBase.js new file mode 100644 index 00000000..d40e9eea --- /dev/null +++ b/imports/codemirror/mode/xquery/test/testBase.js | |||
@@ -0,0 +1,42 @@ | |||
1 | $(document).ready(function(){ | ||
2 | module("testBase"); | ||
3 | test("eviltest", function() { | ||
4 | expect(1); | ||
5 | |||
6 | var input = 'xquery version "1.0-ml";\ | ||
7 | (: this is\ | ||
8 | : a \ | ||
9 | "comment" :)\ | ||
10 | let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x>\ | ||
11 | let $joe:=1\ | ||
12 | return element element {\ | ||
13 | attribute attribute { 1 },\ | ||
14 | element test { 'a' }, \ | ||
15 | attribute foo { "bar" },\ | ||
16 | fn:doc()[ foo/@bar eq $let ],\ | ||
17 | //x } \ | ||
18 | \ | ||
19 | (: a more \'evil\' test :)\ | ||
20 | (: Modified Blakeley example (: with nested comment :) ... :)\ | ||
21 | declare private function local:declare() {()};\ | ||
22 | declare private function local:private() {()};\ | ||
23 | declare private function local:function() {()};\ | ||
24 | declare private function local:local() {()};\ | ||
25 | let $let := <let>let $let := "let"</let>\ | ||
26 | return element element {\ | ||
27 | attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },\ | ||
28 | attribute fn:doc { "bar" castable as xs:string },\ | ||
29 | element text { text { "text" } },\ | ||
30 | fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],\ | ||
31 | //fn:doc\ | ||
32 | }'; | ||
33 | var expected = '<span class="cm-keyword">xquery</span> <span class="cm-keyword">version</span> <span class="cm-string">"1.0-ml"</span><span class="cm-variable cm-def">;</span> <span class="cm-comment">(: this is : a "comment" :)</span> <span class="cm-keyword">let</span> <span class="cm-variable">$let</span> <span class="cm-keyword">:=</span> <span class="cm-tag"><x </span><span class="cm-attribute">attr</span>=<span class="cm-string">"value"</span><span class="cm-tag">></span><span class="cm-word">"test"</span><span class="cm-tag"><func></span><span class="cm-word">function()</span> <span class="cm-word">$var</span> {<span class="cm-keyword">function</span>()} {<span class="cm-variable">$var</span>}<span class="cm-tag"></func></x></span> <span class="cm-keyword">let</span> <span class="cm-variable">$joe</span><span class="cm-keyword">:=</span><span class="cm-atom">1</span> <span class="cm-keyword">return</span> <span class="cm-keyword">element</span> <span class="cm-word">element</span> { <span class="cm-keyword">attribute</span> <span class="cm-word">attribute</span> { <span class="cm-atom">1</span> }, <span class="cm-keyword">element</span> <span class="cm-word">test</span> { <span class="cm-string">\'a\'</span> }, <span class="cm-keyword">attribute</span> <span class="cm-word">foo</span> { <span class="cm-string">"bar"</span> }, <span class="cm-variable cm-def">fn:doc</span>()[ <span class="cm-word">foo</span><span class="cm-keyword">/</span><span class="cm-word">@bar</span> <span class="cm-keyword">eq</span> <span class="cm-variable">$let</span> ], <span class="cm-keyword">//</span><span class="cm-word">x</span> } <span class="cm-comment">(: a more \'evil\' test :)</span> <span class="cm-comment">(: Modified Blakeley example (: with nested comment :) ... :)</span> <span class="cm-keyword">declare</span> <span class="cm-keyword">private</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">local:declare</span>() {()}<span class="cm-word">;</span> <span class="cm-keyword">declare</span> <span class="cm-keyword">private</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">local:private</span>() {()}<span class="cm-word">;</span> <span class="cm-keyword">declare</span> <span class="cm-keyword">private</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">local:function</span>() {()}<span class="cm-word">;</span> <span class="cm-keyword">declare</span> <span class="cm-keyword">private</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">local:local</span>() {()}<span class="cm-word">;</span> <span class="cm-keyword">let</span> <span class="cm-variable">$let</span> <span class="cm-keyword">:=</span> <span class="cm-tag"><let></span><span class="cm-word">let</span> <span class="cm-word">$let</span> <span class="cm-word">:=</span> <span class="cm-word">"let"</span><span class="cm-tag"></let></span> <span class="cm-keyword">return</span> <span class="cm-keyword">element</span> <span class="cm-word">element</span> { <span class="cm-keyword">attribute</span> <span class="cm-word">attribute</span> { <span class="cm-keyword">try</span> { <span class="cm-variable cm-def">xdmp:version</span>() } <span class="cm-keyword">catch</span>(<span class="cm-variable">$e</span>) { <span class="cm-variable cm-def">xdmp:log</span>(<span class="cm-variable">$e</span>) } }, <span class="cm-keyword">attribute</span> <span class="cm-word">fn:doc</span> { <span class="cm-string">"bar"</span> <span class="cm-word">castable</span> <span class="cm-keyword">as</span> <span class="cm-atom">xs:string</span> }, <span class="cm-keyword">element</span> <span class="cm-word">text</span> { <span class="cm-keyword">text</span> { <span class="cm-string">"text"</span> } }, <span class="cm-variable cm-def">fn:doc</span>()[ <span class="cm-qualifier">child::</span><span class="cm-word">eq</span><span class="cm-keyword">/</span>(<span class="cm-word">@bar</span> <span class="cm-keyword">|</span> <span class="cm-qualifier">attribute::</span><span class="cm-word">attribute</span>) <span class="cm-keyword">eq</span> <span class="cm-variable">$let</span> ], <span class="cm-keyword">//</span><span class="cm-word">fn:doc</span> }'; | ||
34 | |||
35 | $("#sandbox").html('<textarea id="editor">' + input + '</textarea>'); | ||
36 | var editor = CodeMirror.fromTextArea($("#editor")[0]); | ||
37 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; | ||
38 | |||
39 | equal(result, expected); | ||
40 | $("#editor").html(""); | ||
41 | }); | ||
42 | }); | ||