-
Notifications
You must be signed in to change notification settings - Fork 35
/
ServerTests.fs
65 lines (52 loc) · 2.13 KB
/
ServerTests.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
module Marksman.ServerTests
open Xunit
open Marksman.Config
open Marksman.Server
open Marksman.State
open Marksman.Folder
open Marksman.Workspace
open Marksman.Helpers
module ServerUtilTests =
[<Fact>]
let textSync_UserConfigEmptyWS () =
let c = { Config.Default with coreTextSync = Some Incremental }
let clientDesc = ClientDescription.empty
let ws = Workspace.ofFolders (Some c) []
Assert.Equal(("userConfig", Incremental), ServerUtil.calcTextSync (Some c) ws clientDesc)
[<Fact>]
let textSync_NoConfigEmptyWS () =
let clientDesc = ClientDescription.empty
let ws = Workspace.ofFolders None []
Assert.Equal(("default", Full), ServerUtil.calcTextSync None ws clientDesc)
[<Fact>]
let textSync_NoConfigEmptyWS_PreferIncr () =
let clientDesc = {
ClientDescription.empty with
opts = { preferredTextSyncKind = Some Incremental }
}
let ws = Workspace.ofFolders None []
Assert.Equal(("clientOption", Incremental), ServerUtil.calcTextSync None ws clientDesc)
[<Fact>]
let textSync_NoConfigNonEmptyWS_PreferIncr () =
let clientDesc = {
ClientDescription.empty with
opts = { preferredTextSyncKind = Some Incremental }
}
let folder =
Folder.multiFile "test" (dummyRootPath [ "test" ] |> mkFolderId) Seq.empty None
let ws = Workspace.ofFolders None [ folder ]
Assert.Equal(("clientOption", Incremental), ServerUtil.calcTextSync None ws clientDesc)
[<Fact>]
let textSync_NonEmptyWS_PreferIncrButConfigTakesPrecedence () =
let clientDesc = {
ClientDescription.empty with
opts = { preferredTextSyncKind = Some Incremental }
}
let folder =
Folder.multiFile
"test"
(dummyRootPath [ "test" ] |> mkFolderId)
Seq.empty
(Some { Config.Empty with coreTextSync = Some Full })
let ws = Workspace.ofFolders None [ folder ]
Assert.Equal(("workspaceConfig", Full), ServerUtil.calcTextSync None ws clientDesc)