Commit 7f2a867
committed
Test example code
This adds sanity tests to ensure that example code in the `examples/`
directory and `README.md` isn't outright wrong. These are not intended
to serve as unit tests for the example functionality, just as smoke
tests to catch things like API changes that require updating examples.
Including a sanity test ensures that the example code isn't outright
wrong. This is not intended to serve as unit tests for the example
functionality.
Some minor changes are included which facilitate this work:
- Use `console` instead of `bash` codeblock language
`console` highlights `$ ` prefixed lines differently from the
following lines, which clearly distinguishes between commands and
input/output.
- Set `file_fixture_path`
This allows us to use `ActiveSupport::TestCase#file_fixture`.
- Add `ReadmeTestHelper`
This helper provides utilities for extracting code snippets from
`README.md`.
Some of these tests revealed that either the examples were busted, or
even bugs in the implementation.
- Test README per-server configuration example
This test revealed that the `define_` helper methods were failing to
ensure the server supports the type of capability they were
defining.
- Test README protocol version examples
This revealed that the `protocol_version` accessors weren't
available on the `Server` at all, and the examples were incorrect.
- Test README tool definition examples
This revealed that the `define` example doesn't work, and the fix is unclear.1 parent 04710ac commit 7f2a867
File tree
22 files changed
+716
-18
lines changed- lib/mcp
- test
- fixtures/files/code_snippet_wrappers/readme
- integration
22 files changed
+716
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
121 | 123 | | |
122 | 124 | | |
123 | 125 | | |
124 | | - | |
| 126 | + | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
| |||
131 | 134 | | |
132 | 135 | | |
133 | 136 | | |
| 137 | + | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| |||
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| 158 | + | |
154 | 159 | | |
155 | 160 | | |
156 | 161 | | |
| |||
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
| 191 | + | |
| 192 | + | |
186 | 193 | | |
187 | 194 | | |
188 | 195 | | |
| |||
224 | 231 | | |
225 | 232 | | |
226 | 233 | | |
| 234 | + | |
227 | 235 | | |
228 | 236 | | |
229 | 237 | | |
| |||
232 | 240 | | |
233 | 241 | | |
234 | 242 | | |
235 | | - | |
| 243 | + | |
236 | 244 | | |
| 245 | + | |
237 | 246 | | |
238 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
239 | 250 | | |
240 | 251 | | |
241 | 252 | | |
242 | 253 | | |
| 254 | + | |
243 | 255 | | |
244 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
245 | 259 | | |
246 | 260 | | |
247 | 261 | | |
| |||
274 | 288 | | |
275 | 289 | | |
276 | 290 | | |
| 291 | + | |
277 | 292 | | |
278 | 293 | | |
279 | 294 | | |
| |||
301 | 316 | | |
302 | 317 | | |
303 | 318 | | |
| 319 | + | |
304 | 320 | | |
305 | 321 | | |
306 | 322 | | |
| |||
337 | 353 | | |
338 | 354 | | |
339 | 355 | | |
| 356 | + | |
340 | 357 | | |
341 | 358 | | |
342 | 359 | | |
343 | 360 | | |
344 | 361 | | |
345 | | - | |
| 362 | + | |
346 | 363 | | |
347 | 364 | | |
348 | 365 | | |
| |||
351 | 368 | | |
352 | 369 | | |
353 | 370 | | |
354 | | - | |
| 371 | + | |
355 | 372 | | |
356 | 373 | | |
357 | | - | |
| 374 | + | |
358 | 375 | | |
359 | | - | |
| 376 | + | |
360 | 377 | | |
361 | | - | |
| 378 | + | |
362 | 379 | | |
363 | | - | |
| 380 | + | |
364 | 381 | | |
365 | 382 | | |
366 | 383 | | |
| |||
373 | 390 | | |
374 | 391 | | |
375 | 392 | | |
| 393 | + | |
376 | 394 | | |
377 | 395 | | |
378 | 396 | | |
379 | 397 | | |
380 | 398 | | |
381 | | - | |
| 399 | + | |
382 | 400 | | |
383 | 401 | | |
384 | 402 | | |
385 | 403 | | |
386 | 404 | | |
387 | 405 | | |
388 | | - | |
| 406 | + | |
389 | 407 | | |
390 | 408 | | |
391 | | - | |
| 409 | + | |
392 | 410 | | |
393 | | - | |
| 411 | + | |
394 | 412 | | |
395 | | - | |
| 413 | + | |
396 | 414 | | |
397 | | - | |
| 415 | + | |
398 | 416 | | |
399 | 417 | | |
400 | 418 | | |
| |||
415 | 433 | | |
416 | 434 | | |
417 | 435 | | |
| 436 | + | |
418 | 437 | | |
419 | 438 | | |
420 | 439 | | |
| |||
433 | 452 | | |
434 | 453 | | |
435 | 454 | | |
| 455 | + | |
436 | 456 | | |
437 | 457 | | |
438 | 458 | | |
| |||
458 | 478 | | |
459 | 479 | | |
460 | 480 | | |
| 481 | + | |
461 | 482 | | |
462 | 483 | | |
463 | 484 | | |
| |||
474 | 495 | | |
475 | 496 | | |
476 | 497 | | |
| 498 | + | |
477 | 499 | | |
478 | 500 | | |
479 | 501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| |||
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
| 122 | + | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| |||
125 | 129 | | |
126 | 130 | | |
127 | 131 | | |
| 132 | + | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments