????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.148.241.210 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/javascript/codemirror/mode/xquery/test/ |
Upload File : |
$(document).ready(function(){ module("test namespaces"); // -------------------------------------------------------------------------------- // this test is based on this: //http://mbrevoort.github.com/CodeMirror2/#!exprSeqTypes/PrologExpr/VariableProlog/ExternalVariablesWith/K2-ExternalVariablesWith-10.xq // -------------------------------------------------------------------------------- test("test namespaced variable", function() { expect(1); var input = 'declare namespace e = "http://example.com/ANamespace";\ declare variable $e:exampleComThisVarIsNotRecognized as element(*) external;'; var expected = '<span class="cm-keyword">declare</span> <span class="cm-keyword">namespace</span> <span class="cm-word">e</span> <span class="cm-keyword">=</span> <span class="cm-string">"http://example.com/ANamespace"</span><span class="cm-word">;declare</span> <span class="cm-keyword">variable</span> <span class="cm-variable">$e:exampleComThisVarIsNotRecognized</span> <span class="cm-keyword">as</span> <span class="cm-keyword">element</span>(<span class="cm-keyword">*</span>) <span class="cm-word">external;</span>'; $("#sandbox").html('<textarea id="editor">' + input + '</textarea>'); var editor = CodeMirror.fromTextArea($("#editor")[0]); var result = $(".CodeMirror-lines div div pre")[0].innerHTML; equal(result, expected); $("#editor").html(""); }); // -------------------------------------------------------------------------------- // this test is based on: // http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-002.xq // -------------------------------------------------------------------------------- test("test EQName variable", function() { expect(1); var input = 'declare variable $"http://www.example.com/ns/my":var := 12;\ <out>{$"http://www.example.com/ns/my":var}</out>'; var expected = '<span class="cm-keyword">declare</span> <span class="cm-keyword">variable</span> <span class="cm-variable">$"http://www.example.com/ns/my":var</span> <span class="cm-keyword">:=</span> <span class="cm-atom">12</span><span class="cm-word">;</span><span class="cm-tag"><out></span>{<span class="cm-variable">$"http://www.example.com/ns/my":var</span>}<span class="cm-tag"></out></span>'; $("#sandbox").html('<textarea id="editor">' + input + '</textarea>'); var editor = CodeMirror.fromTextArea($("#editor")[0]); var result = $(".CodeMirror-lines div div pre")[0].innerHTML; equal(result, expected); $("#editor").html(""); }); // -------------------------------------------------------------------------------- // this test is based on: // http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq // -------------------------------------------------------------------------------- test("test EQName function", function() { expect(1); var input = 'declare function "http://www.example.com/ns/my":fn ($a as xs:integer) as xs:integer {\ $a + 2\ };\ <out>{"http://www.example.com/ns/my":fn(12)}</out>'; var expected = '<span class="cm-keyword">declare</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">"http://www.example.com/ns/my":fn</span> (<span class="cm-variable">$a</span> <span class="cm-keyword">as</span> <span class="cm-atom">xs:integer</span>) <span class="cm-keyword">as</span> <span class="cm-atom">xs:integer</span> { <span class="cm-variable">$a</span> <span class="cm-keyword">+</span> <span class="cm-atom">2</span>}<span class="cm-word">;</span><span class="cm-tag"><out></span>{<span class="cm-variable cm-def">"http://www.example.com/ns/my":fn</span>(<span class="cm-atom">12</span>)}<span class="cm-tag"></out></span>'; $("#sandbox").html('<textarea id="editor">' + input + '</textarea>'); var editor = CodeMirror.fromTextArea($("#editor")[0]); var result = $(".CodeMirror-lines div div pre")[0].innerHTML; equal(result, expected); $("#editor").html(""); }); // -------------------------------------------------------------------------------- // this test is based on: // http://mbrevoort.github.com/CodeMirror2/#!Basics/EQNames/eqname-003.xq // -------------------------------------------------------------------------------- test("test EQName function with single quotes", function() { expect(1); var input = 'declare function \'http://www.example.com/ns/my\':fn ($a as xs:integer) as xs:integer {\ $a + 2\ };\ <out>{\'http://www.example.com/ns/my\':fn(12)}</out>'; var expected = '<span class="cm-keyword">declare</span> <span class="cm-keyword">function</span> <span class="cm-variable cm-def">\'http://www.example.com/ns/my\':fn</span> (<span class="cm-variable">$a</span> <span class="cm-keyword">as</span> <span class="cm-atom">xs:integer</span>) <span class="cm-keyword">as</span> <span class="cm-atom">xs:integer</span> { <span class="cm-variable">$a</span> <span class="cm-keyword">+</span> <span class="cm-atom">2</span>}<span class="cm-word">;</span><span class="cm-tag"><out></span>{<span class="cm-variable cm-def">\'http://www.example.com/ns/my\':fn</span>(<span class="cm-atom">12</span>)}<span class="cm-tag"></out></span>'; $("#sandbox").html('<textarea id="editor">' + input + '</textarea>'); var editor = CodeMirror.fromTextArea($("#editor")[0]); var result = $(".CodeMirror-lines div div pre")[0].innerHTML; equal(result, expected); $("#editor").html(""); }); });