$(document).ready(function(){
module("testBase");
test("eviltest", function() {
expect(1);
var input = 'xquery version "1.0-ml";\
(: this is\
: a \
"comment" :)\
let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x>\
let $joe:=1\
return element element {\
attribute attribute { 1 },\
element test { 'a' }, \
attribute foo { "bar" },\
fn:doc()[ foo/@bar eq $let ],\
//x } \
\
(: a more \'evil\' test :)\
(: Modified Blakeley example (: with nested comment :) ... :)\
declare private function local:declare() {()};\
declare private function local:private() {()};\
declare private function local:function() {()};\
declare private function local:local() {()};\
let $let := <let>let $let := "let"</let>\
return element element {\
attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },\
attribute fn:doc { "bar" castable as xs:string },\
element text { text { "text" } },\
fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],\
//fn:doc\
}';
var expected = 'xquery version "1.0-ml"; let $let := <x attr="value">"test"<func>function() $var {function()} {$var}</func></x> let $joe:=1 return element element { attribute attribute { 1 }, element test { \'a\' }, attribute foo { "bar" }, fn:doc()[ foo/@bar eq $let ], //x } declare private function local:declare() {()}; declare private function local:private() {()}; declare private function local:function() {()}; declare private function local:local() {()}; let $let := <let>let $let := "let"</let> return element element { attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } }, attribute fn:doc { "bar" castable as xs:string }, element text { text { "text" } }, fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ], //fn:doc }';
$("#sandbox").html('');
var editor = CodeMirror.fromTextArea($("#editor")[0]);
var result = $(".CodeMirror-lines div div pre")[0].innerHTML;
equal(result, expected);
$("#editor").html("");
});
});