shuffle around how encoding works in the tests
This commit is contained in:
parent
c92ea1c3ca
commit
e47ee55784
@ -1,15 +1,14 @@
|
|||||||
(local faith (require :faith))
|
(local faith (require :faith))
|
||||||
(local {: create-client-with-files
|
(local {: create-client-with-files} (require :test.utils))
|
||||||
: default-encoding} (require :test.utils))
|
|
||||||
(local {: null} (require :fennel-ls.json.json))
|
(local {: null} (require :fennel-ls.json.json))
|
||||||
(local {: apply-edits} (require :fennel-ls.utils))
|
(local {: apply-edits} (require :fennel-ls.utils))
|
||||||
|
|
||||||
(fn check [file-content new-name expected-file-content]
|
(fn check [file-content new-name expected-file-content]
|
||||||
(let [{: self : uri : cursor : text} (create-client-with-files file-content)
|
(let [{: self : uri : cursor : text : encoding} (create-client-with-files file-content)
|
||||||
[{: result}] (self:rename uri cursor new-name)]
|
[{: result}] (self:rename uri cursor new-name)]
|
||||||
(if (= null result)
|
(if (= null result)
|
||||||
(faith.= expected-file-content text)
|
(faith.= expected-file-content text)
|
||||||
(let [new-content (apply-edits text (. result.changes uri) default-encoding)]
|
(let [new-content (apply-edits text (. result.changes uri) encoding)]
|
||||||
(faith.= expected-file-content new-content)))))
|
(faith.= expected-file-content new-content)))))
|
||||||
|
|
||||||
(fn test-rename []
|
(fn test-rename []
|
||||||
|
|||||||
@ -57,12 +57,12 @@
|
|||||||
: cursor
|
: cursor
|
||||||
: locations
|
: locations
|
||||||
: text
|
: text
|
||||||
: uri}))))
|
: uri
|
||||||
|
:encoding self.server.position-encoding}))))
|
||||||
|
|
||||||
(fn position-past-end-of-text [text ?encoding]
|
(fn position-past-end-of-text [text ?encoding]
|
||||||
(utils.byte->position text (+ (length text) 1) (or ?encoding default-encoding)))
|
(utils.byte->position text (+ (length text) 1) (or ?encoding default-encoding)))
|
||||||
|
|
||||||
{: create-client-with-files
|
{: create-client-with-files
|
||||||
: position-past-end-of-text
|
: position-past-end-of-text
|
||||||
: default-encoding
|
|
||||||
: get-markup}
|
: get-markup}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user