[fix] tests
This commit is contained in:
parent
bebbf38686
commit
23fc83f295
3 changed files with 33 additions and 24 deletions
|
|
@ -42,7 +42,7 @@ declare %unit:test function test:update-start() {
|
|||
return ()
|
||||
};
|
||||
|
||||
(:~ we can create update from string :)
|
||||
(:~ we can update the end of a line :)
|
||||
declare %unit:test function test:update-end() {
|
||||
let $doc:="a
|
||||
123456789
|
||||
|
|
@ -57,6 +57,19 @@ b"
|
|||
return unit:assert-equals($doc,doci:text($update))
|
||||
};
|
||||
|
||||
(:~ we can update to remove a line :)
|
||||
declare %unit:test function test:update-lines() {
|
||||
let $doc:="a
|
||||
123456789
|
||||
b"
|
||||
let $doci:= doci:build($doc)
|
||||
let $_:=test:expected($doci,$doc,3)
|
||||
let $change:=test:def-change("",0,1,2,0)
|
||||
let $doci2:=doci:update($doci,$change)
|
||||
let $_:=test:expected($doci2,"ab",1)
|
||||
return true()
|
||||
};
|
||||
|
||||
(: test $doci properties as expected :)
|
||||
declare function test:expected($doci as doci:doci, $doc as xs:string, $lines as xs:integer){
|
||||
unit:assert-equals(doci:lines($doci),$lines),
|
||||
|
|
|
|||
|
|
@ -1,22 +1,12 @@
|
|||
import module namespace doci = 'urn:quodatum:text:doci' at "../src/doci.xqm";
|
||||
import module namespace test = 'test:doci' at "simple.xqm";
|
||||
|
||||
declare variable $long:=
|
||||
file:read-text("C:\Users\mrwhe\git\quodatum\basex-lsp\test\sample.docs\pdfbox.xqm");
|
||||
declare variable $text:="123456789";
|
||||
|
||||
(: create a change description:)
|
||||
declare function local:change($text as xs:string,
|
||||
$sline as xs:integer,$schar as xs:integer,
|
||||
$eline as xs:integer,$echar as xs:integer
|
||||
)
|
||||
as doci:TextDocumentContentChangeEvent{
|
||||
doci:TextDocumentContentChangeEvent(
|
||||
$text,
|
||||
doci:Range(doci:Position($sline,$schar),doci:Position($eline,$echar))
|
||||
)
|
||||
};
|
||||
let $doc:="a
|
||||
123456789
|
||||
b"
|
||||
|
||||
|
||||
|
||||
doci:build($text)
|
||||
=>doci:update(local:change("*",0,0,0,0))
|
||||
return doci:build($doc)
|
||||
=>doci:update(test:def-change("",0,1,2,0))
|
||||
Loading…
Add table
Add a link
Reference in a new issue