shuffle around how encoding works in the tests

This commit is contained in:
XeroOl 2024-03-28 22:38:01 -05:00
parent c92ea1c3ca
commit e47ee55784
2 changed files with 5 additions and 6 deletions

View File

@ -1,15 +1,14 @@
(local faith (require :faith))
(local {: create-client-with-files
: default-encoding} (require :test.utils))
(local {: create-client-with-files} (require :test.utils))
(local {: null} (require :fennel-ls.json.json))
(local {: apply-edits} (require :fennel-ls.utils))
(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)]
(if (= null result)
(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)))))
(fn test-rename []

View File

@ -57,12 +57,12 @@
: cursor
: locations
: text
: uri}))))
: uri
:encoding self.server.position-encoding}))))
(fn position-past-end-of-text [text ?encoding]
(utils.byte->position text (+ (length text) 1) (or ?encoding default-encoding)))
{: create-client-with-files
: position-past-end-of-text
: default-encoding
: get-markup}