@@ -95,7 +95,7 @@ suite "Nimlangserver extensions":
95
95
let testProjectInfo = tests.projectInfo
96
96
check testProjectInfo.suites.len == 3
97
97
check testProjectInfo.suites[" Sample Tests" ].tests.len == 1
98
- check testProjectInfo.suites[" Sample Tests" ].tests[0 ].name == " Sample Test"
98
+ check testProjectInfo.suites[" Sample Tests" ].tests[0 ].name == " Sample Test alone "
99
99
check testProjectInfo.suites[" Sample Tests" ].tests[0 ].file == " sampletests.nim"
100
100
check testProjectInfo.suites[" Sample Tests" ].tests[0 ].line == 4
101
101
@@ -119,4 +119,59 @@ suite "Nimlangserver extensions":
119
119
check runTestsRes.suites[0 ].failures == 0
120
120
check runTestsRes.suites[0 ].errors == 0
121
121
check runTestsRes.suites[0 ].skipped == 0
122
- check runTestsRes.suites[0 ].time > 0.0 and runTestsRes.suites[0 ].time < 1.0
122
+ check runTestsRes.suites[0 ].time > 0.0 and runTestsRes.suites[0 ].time < 1.0
123
+
124
+ test " calling extension/runTest with a suite name should run the tests in the suite" :
125
+ let initParams =
126
+ InitializeParams %* {
127
+ " processId" : % getCurrentProcessId (),
128
+ " rootUri" : fixtureUri (" projects/testrunner/" ),
129
+ " capabilities" :
130
+ {" window" : {" workDoneProgress" : true }, " workspace" : {" configuration" : true }},
131
+ }
132
+ let initializeResult = waitFor client.initialize (initParams)
133
+
134
+ let suiteName = " Sample Suite"
135
+ let runTestsParams = RunTestParams (entryPoints: @ [" tests/projects/testrunner/tests/sampletests.nim" .absolutePath], suiteName: suiteName)
136
+ let runTestsRes = client.call (" extension/runTests" , jsonutils.toJson (runTestsParams)).waitFor ().jsonTo (
137
+ RunTestProjectResult
138
+ )
139
+ check runTestsRes.suites.len == 1
140
+ check runTestsRes.suites[0 ].name == suiteName
141
+ check runTestsRes.suites[0 ].tests == 3
142
+
143
+ test " calling extension/runTest with a test name should run the tests in the suite" :
144
+ let initParams =
145
+ InitializeParams %* {
146
+ " processId" : % getCurrentProcessId (),
147
+ " rootUri" : fixtureUri (" projects/testrunner/" ),
148
+ " capabilities" :
149
+ {" window" : {" workDoneProgress" : true }, " workspace" : {" configuration" : true }},
150
+ }
151
+
152
+ let initializeResult = waitFor client.initialize (initParams)
153
+
154
+ let testName = " Sample Test"
155
+ let runTestsParams = RunTestParams (entryPoints: @ [" tests/projects/testrunner/tests/sampletests.nim" .absolutePath], testNames: @ [testName])
156
+ let runTestsRes = client.call (" extension/runTests" , jsonutils.toJson (runTestsParams)).waitFor ().jsonTo (RunTestProjectResult )
157
+
158
+ check runTestsRes.suites.len == 1
159
+ check runTestsRes.suites[0 ].tests == 1
160
+ check runTestsRes.suites[0 ].testResults[0 ].name == testName
161
+
162
+ test " calling extension/runTest with multiple test names should run the tests in the suite" :
163
+ let initParams =
164
+ InitializeParams %* {
165
+ " processId" : % getCurrentProcessId (),
166
+ " rootUri" : fixtureUri (" projects/testrunner/" ),
167
+ " capabilities" :
168
+ {" window" : {" workDoneProgress" : true }, " workspace" : {" configuration" : true }},
169
+ }
170
+ let initializeResult = waitFor client.initialize (initParams)
171
+
172
+ let testNames = @ [" Sample Test" , " Sample Test 2" ]
173
+ let runTestsParams = RunTestParams (entryPoints: @ [" tests/projects/testrunner/tests/sampletests.nim" .absolutePath], testNames: testNames)
174
+ let runTestsRes = client.call (" extension/runTests" , jsonutils.toJson (runTestsParams)).waitFor ().jsonTo (RunTestProjectResult )
175
+
176
+ check runTestsRes.suites.len == 1
177
+ check runTestsRes.suites[0 ].tests == 2
0 commit comments