aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_ide/src/runnables.rs1036
1 files changed, 511 insertions, 525 deletions
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index f569a3f17..ed15d6494 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -251,13 +251,21 @@ fn runnable_mod(
251 251
252#[cfg(test)] 252#[cfg(test)]
253mod tests { 253mod tests {
254 use insta::assert_debug_snapshot; 254 use expect::{expect, Expect};
255 255
256 use crate::mock_analysis::analysis_and_position; 256 use crate::mock_analysis::analysis_and_position;
257 257
258 use super::{Runnable, RunnableAction, BENCH, BIN, DOCTEST, TEST}; 258 use super::{RunnableAction, BENCH, BIN, DOCTEST, TEST};
259 259
260 fn assert_actions(runnables: &[Runnable], actions: &[&RunnableAction]) { 260 fn check(
261 ra_fixture: &str,
262 // FIXME: fold this into `expect` as well
263 actions: &[&RunnableAction],
264 expect: Expect,
265 ) {
266 let (analysis, position) = analysis_and_position(ra_fixture);
267 let runnables = analysis.runnables(position.file_id).unwrap();
268 expect.assert_debug_eq(&runnables);
261 assert_eq!( 269 assert_eq!(
262 actions, 270 actions,
263 runnables.into_iter().map(|it| it.action()).collect::<Vec<_>>().as_slice() 271 runnables.into_iter().map(|it| it.action()).collect::<Vec<_>>().as_slice()
@@ -266,579 +274,557 @@ mod tests {
266 274
267 #[test] 275 #[test]
268 fn test_runnables() { 276 fn test_runnables() {
269 let (analysis, pos) = analysis_and_position( 277 check(
270 r#" 278 r#"
271 //- /lib.rs 279//- /lib.rs
272 <|> //empty 280<|>
273 fn main() {} 281fn main() {}
274 282
275 #[test] 283#[test]
276 fn test_foo() {} 284fn test_foo() {}
277 285
278 #[test] 286#[test]
279 #[ignore] 287#[ignore]
280 fn test_foo() {} 288fn test_foo() {}
281 289
282 #[bench] 290#[bench]
283 fn bench() {} 291fn bench() {}
284 "#, 292"#,
285 ); 293 &[&BIN, &TEST, &TEST, &BENCH],
286 let runnables = analysis.runnables(pos.file_id).unwrap(); 294 expect![[r#"
287 assert_debug_snapshot!(&runnables, 295 [
288 @r###" 296 Runnable {
289 [ 297 nav: NavigationTarget {
290 Runnable { 298 file_id: FileId(
291 nav: NavigationTarget { 299 1,
292 file_id: FileId( 300 ),
293 1, 301 full_range: 1..13,
294 ), 302 name: "main",
295 full_range: 1..21, 303 kind: FN_DEF,
296 name: "main", 304 focus_range: Some(
297 kind: FN_DEF, 305 4..8,
298 focus_range: Some( 306 ),
299 12..16, 307 container_name: None,
300 ), 308 description: None,
301 container_name: None, 309 docs: None,
302 description: None, 310 },
303 docs: None, 311 kind: Bin,
304 }, 312 cfg_exprs: [],
305 kind: Bin,
306 cfg_exprs: [],
307 },
308 Runnable {
309 nav: NavigationTarget {
310 file_id: FileId(
311 1,
312 ),
313 full_range: 23..47,
314 name: "test_foo",
315 kind: FN_DEF,
316 focus_range: Some(
317 34..42,
318 ),
319 container_name: None,
320 description: None,
321 docs: None,
322 },
323 kind: Test {
324 test_id: Path(
325 "test_foo",
326 ),
327 attr: TestAttr {
328 ignore: false,
329 }, 313 },
330 }, 314 Runnable {
331 cfg_exprs: [], 315 nav: NavigationTarget {
332 }, 316 file_id: FileId(
333 Runnable { 317 1,
334 nav: NavigationTarget { 318 ),
335 file_id: FileId( 319 full_range: 15..39,
336 1, 320 name: "test_foo",
337 ), 321 kind: FN_DEF,
338 full_range: 49..83, 322 focus_range: Some(
339 name: "test_foo", 323 26..34,
340 kind: FN_DEF, 324 ),
341 focus_range: Some( 325 container_name: None,
342 70..78, 326 description: None,
343 ), 327 docs: None,
344 container_name: None, 328 },
345 description: None, 329 kind: Test {
346 docs: None, 330 test_id: Path(
347 }, 331 "test_foo",
348 kind: Test { 332 ),
349 test_id: Path( 333 attr: TestAttr {
350 "test_foo", 334 ignore: false,
351 ), 335 },
352 attr: TestAttr { 336 },
353 ignore: true, 337 cfg_exprs: [],
338 },
339 Runnable {
340 nav: NavigationTarget {
341 file_id: FileId(
342 1,
343 ),
344 full_range: 41..75,
345 name: "test_foo",
346 kind: FN_DEF,
347 focus_range: Some(
348 62..70,
349 ),
350 container_name: None,
351 description: None,
352 docs: None,
353 },
354 kind: Test {
355 test_id: Path(
356 "test_foo",
357 ),
358 attr: TestAttr {
359 ignore: true,
360 },
361 },
362 cfg_exprs: [],
354 }, 363 },
355 }, 364 Runnable {
356 cfg_exprs: [], 365 nav: NavigationTarget {
357 }, 366 file_id: FileId(
358 Runnable { 367 1,
359 nav: NavigationTarget { 368 ),
360 file_id: FileId( 369 full_range: 77..99,
361 1, 370 name: "bench",
362 ), 371 kind: FN_DEF,
363 full_range: 85..107, 372 focus_range: Some(
364 name: "bench", 373 89..94,
365 kind: FN_DEF, 374 ),
366 focus_range: Some( 375 container_name: None,
367 97..102, 376 description: None,
368 ), 377 docs: None,
369 container_name: None, 378 },
370 description: None, 379 kind: Bench {
371 docs: None, 380 test_id: Path(
372 }, 381 "bench",
373 kind: Bench { 382 ),
374 test_id: Path( 383 },
375 "bench", 384 cfg_exprs: [],
376 ), 385 },
377 }, 386 ]
378 cfg_exprs: [], 387 "#]],
379 }, 388 );
380 ]
381 "###
382 );
383 assert_actions(&runnables, &[&BIN, &TEST, &TEST, &BENCH]);
384 } 389 }
385 390
386 #[test] 391 #[test]
387 fn test_runnables_doc_test() { 392 fn test_runnables_doc_test() {
388 let (analysis, pos) = analysis_and_position( 393 check(
389 r#" 394 r#"
390 //- /lib.rs 395//- /lib.rs
391 <|> //empty 396<|>
392 fn main() {} 397fn main() {}
393 398
394 /// ``` 399/// ```
395 /// let x = 5; 400/// let x = 5;
396 /// ``` 401/// ```
397 fn foo() {} 402fn foo() {}
398 "#, 403"#,
404 &[&BIN, &DOCTEST],
405 expect![[r#"
406 [
407 Runnable {
408 nav: NavigationTarget {
409 file_id: FileId(
410 1,
411 ),
412 full_range: 1..13,
413 name: "main",
414 kind: FN_DEF,
415 focus_range: Some(
416 4..8,
417 ),
418 container_name: None,
419 description: None,
420 docs: None,
421 },
422 kind: Bin,
423 cfg_exprs: [],
424 },
425 Runnable {
426 nav: NavigationTarget {
427 file_id: FileId(
428 1,
429 ),
430 full_range: 15..57,
431 name: "foo",
432 kind: FN_DEF,
433 focus_range: None,
434 container_name: None,
435 description: None,
436 docs: None,
437 },
438 kind: DocTest {
439 test_id: Path(
440 "foo",
441 ),
442 },
443 cfg_exprs: [],
444 },
445 ]
446 "#]],
399 ); 447 );
400 let runnables = analysis.runnables(pos.file_id).unwrap();
401 assert_debug_snapshot!(&runnables,
402 @r###"
403 [
404 Runnable {
405 nav: NavigationTarget {
406 file_id: FileId(
407 1,
408 ),
409 full_range: 1..21,
410 name: "main",
411 kind: FN_DEF,
412 focus_range: Some(
413 12..16,
414 ),
415 container_name: None,
416 description: None,
417 docs: None,
418 },
419 kind: Bin,
420 cfg_exprs: [],
421 },
422 Runnable {
423 nav: NavigationTarget {
424 file_id: FileId(
425 1,
426 ),
427 full_range: 23..65,
428 name: "foo",
429 kind: FN_DEF,
430 focus_range: None,
431 container_name: None,
432 description: None,
433 docs: None,
434 },
435 kind: DocTest {
436 test_id: Path(
437 "foo",
438 ),
439 },
440 cfg_exprs: [],
441 },
442 ]
443 "###
444 );
445 assert_actions(&runnables, &[&BIN, &DOCTEST]);
446 } 448 }
447 449
448 #[test] 450 #[test]
449 fn test_runnables_doc_test_in_impl() { 451 fn test_runnables_doc_test_in_impl() {
450 let (analysis, pos) = analysis_and_position( 452 check(
451 r#" 453 r#"
452 //- /lib.rs 454//- /lib.rs
453 <|> //empty 455<|>
454 fn main() {} 456fn main() {}
455 457
456 struct Data; 458struct Data;
457 impl Data { 459impl Data {
458 /// ``` 460 /// ```
459 /// let x = 5; 461 /// let x = 5;
460 /// ``` 462 /// ```
461 fn foo() {} 463 fn foo() {}
462 } 464}
463 "#, 465"#,
466 &[&BIN, &DOCTEST],
467 expect![[r#"
468 [
469 Runnable {
470 nav: NavigationTarget {
471 file_id: FileId(
472 1,
473 ),
474 full_range: 1..13,
475 name: "main",
476 kind: FN_DEF,
477 focus_range: Some(
478 4..8,
479 ),
480 container_name: None,
481 description: None,
482 docs: None,
483 },
484 kind: Bin,
485 cfg_exprs: [],
486 },
487 Runnable {
488 nav: NavigationTarget {
489 file_id: FileId(
490 1,
491 ),
492 full_range: 44..98,
493 name: "foo",
494 kind: FN_DEF,
495 focus_range: None,
496 container_name: None,
497 description: None,
498 docs: None,
499 },
500 kind: DocTest {
501 test_id: Path(
502 "Data::foo",
503 ),
504 },
505 cfg_exprs: [],
506 },
507 ]
508 "#]],
464 ); 509 );
465 let runnables = analysis.runnables(pos.file_id).unwrap();
466 assert_debug_snapshot!(&runnables,
467 @r###"
468 [
469 Runnable {
470 nav: NavigationTarget {
471 file_id: FileId(
472 1,
473 ),
474 full_range: 1..21,
475 name: "main",
476 kind: FN_DEF,
477 focus_range: Some(
478 12..16,
479 ),
480 container_name: None,
481 description: None,
482 docs: None,
483 },
484 kind: Bin,
485 cfg_exprs: [],
486 },
487 Runnable {
488 nav: NavigationTarget {
489 file_id: FileId(
490 1,
491 ),
492 full_range: 52..106,
493 name: "foo",
494 kind: FN_DEF,
495 focus_range: None,
496 container_name: None,
497 description: None,
498 docs: None,
499 },
500 kind: DocTest {
501 test_id: Path(
502 "Data::foo",
503 ),
504 },
505 cfg_exprs: [],
506 },
507 ]
508 "###
509 );
510 assert_actions(&runnables, &[&BIN, &DOCTEST]);
511 } 510 }
512 511
513 #[test] 512 #[test]
514 fn test_runnables_module() { 513 fn test_runnables_module() {
515 let (analysis, pos) = analysis_and_position( 514 check(
516 r#" 515 r#"
517 //- /lib.rs 516//- /lib.rs
518 <|> //empty 517<|>
519 mod test_mod { 518mod test_mod {
520 #[test] 519 #[test]
521 fn test_foo1() {} 520 fn test_foo1() {}
522 } 521}
523 "#, 522"#,
524 ); 523 &[&TEST, &TEST],
525 let runnables = analysis.runnables(pos.file_id).unwrap(); 524 expect![[r#"
526 assert_debug_snapshot!(&runnables, 525 [
527 @r###" 526 Runnable {
528 [ 527 nav: NavigationTarget {
529 Runnable { 528 file_id: FileId(
530 nav: NavigationTarget { 529 1,
531 file_id: FileId( 530 ),
532 1, 531 full_range: 1..51,
533 ), 532 name: "test_mod",
534 full_range: 1..59, 533 kind: MODULE,
535 name: "test_mod", 534 focus_range: Some(
536 kind: MODULE, 535 5..13,
537 focus_range: Some( 536 ),
538 13..21, 537 container_name: None,
539 ), 538 description: None,
540 container_name: None, 539 docs: None,
541 description: None, 540 },
542 docs: None, 541 kind: TestMod {
543 }, 542 path: "test_mod",
544 kind: TestMod { 543 },
545 path: "test_mod", 544 cfg_exprs: [],
546 }, 545 },
547 cfg_exprs: [], 546 Runnable {
548 }, 547 nav: NavigationTarget {
549 Runnable { 548 file_id: FileId(
550 nav: NavigationTarget { 549 1,
551 file_id: FileId( 550 ),
552 1, 551 full_range: 20..49,
553 ), 552 name: "test_foo1",
554 full_range: 28..57, 553 kind: FN_DEF,
555 name: "test_foo1", 554 focus_range: Some(
556 kind: FN_DEF, 555 35..44,
557 focus_range: Some( 556 ),
558 43..52, 557 container_name: None,
559 ), 558 description: None,
560 container_name: None, 559 docs: None,
561 description: None, 560 },
562 docs: None, 561 kind: Test {
563 }, 562 test_id: Path(
564 kind: Test { 563 "test_mod::test_foo1",
565 test_id: Path( 564 ),
566 "test_mod::test_foo1", 565 attr: TestAttr {
567 ), 566 ignore: false,
568 attr: TestAttr { 567 },
569 ignore: false, 568 },
569 cfg_exprs: [],
570 }, 570 },
571 }, 571 ]
572 cfg_exprs: [], 572 "#]],
573 }, 573 );
574 ]
575 "###
576 );
577 assert_actions(&runnables, &[&TEST, &TEST]);
578 } 574 }
579 575
580 #[test] 576 #[test]
581 fn test_runnables_one_depth_layer_module() { 577 fn test_runnables_one_depth_layer_module() {
582 let (analysis, pos) = analysis_and_position( 578 check(
583 r#" 579 r#"
584 //- /lib.rs 580//- /lib.rs
585 <|> //empty 581<|>
586 mod foo { 582mod foo {
587 mod test_mod { 583 mod test_mod {
588 #[test] 584 #[test]
589 fn test_foo1() {} 585 fn test_foo1() {}
590 } 586 }
591 } 587}
592 "#, 588"#,
593 ); 589 &[&TEST, &TEST],
594 let runnables = analysis.runnables(pos.file_id).unwrap(); 590 expect![[r#"
595 assert_debug_snapshot!(&runnables, 591 [
596 @r###" 592 Runnable {
597 [ 593 nav: NavigationTarget {
598 Runnable { 594 file_id: FileId(
599 nav: NavigationTarget { 595 1,
600 file_id: FileId( 596 ),
601 1, 597 full_range: 15..77,
602 ), 598 name: "test_mod",
603 full_range: 23..85, 599 kind: MODULE,
604 name: "test_mod", 600 focus_range: Some(
605 kind: MODULE, 601 19..27,
606 focus_range: Some( 602 ),
607 27..35, 603 container_name: None,
608 ), 604 description: None,
609 container_name: None, 605 docs: None,
610 description: None, 606 },
611 docs: None, 607 kind: TestMod {
612 }, 608 path: "foo::test_mod",
613 kind: TestMod { 609 },
614 path: "foo::test_mod", 610 cfg_exprs: [],
615 }, 611 },
616 cfg_exprs: [], 612 Runnable {
617 }, 613 nav: NavigationTarget {
618 Runnable { 614 file_id: FileId(
619 nav: NavigationTarget { 615 1,
620 file_id: FileId( 616 ),
621 1, 617 full_range: 38..71,
622 ), 618 name: "test_foo1",
623 full_range: 46..79, 619 kind: FN_DEF,
624 name: "test_foo1", 620 focus_range: Some(
625 kind: FN_DEF, 621 57..66,
626 focus_range: Some( 622 ),
627 65..74, 623 container_name: None,
628 ), 624 description: None,
629 container_name: None, 625 docs: None,
630 description: None, 626 },
631 docs: None, 627 kind: Test {
632 }, 628 test_id: Path(
633 kind: Test { 629 "foo::test_mod::test_foo1",
634 test_id: Path( 630 ),
635 "foo::test_mod::test_foo1", 631 attr: TestAttr {
636 ), 632 ignore: false,
637 attr: TestAttr { 633 },
638 ignore: false, 634 },
635 cfg_exprs: [],
639 }, 636 },
640 }, 637 ]
641 cfg_exprs: [], 638 "#]],
642 }, 639 );
643 ]
644 "###
645 );
646 assert_actions(&runnables, &[&TEST, &TEST]);
647 } 640 }
648 641
649 #[test] 642 #[test]
650 fn test_runnables_multiple_depth_module() { 643 fn test_runnables_multiple_depth_module() {
651 let (analysis, pos) = analysis_and_position( 644 check(
652 r#" 645 r#"
653 //- /lib.rs 646//- /lib.rs
654 <|> //empty 647<|>
655 mod foo { 648mod foo {
656 mod bar { 649 mod bar {
657 mod test_mod { 650 mod test_mod {
658 #[test] 651 #[test]
659 fn test_foo1() {} 652 fn test_foo1() {}
660 }
661 }
662 } 653 }
663 "#, 654 }
664 ); 655}
665 let runnables = analysis.runnables(pos.file_id).unwrap(); 656"#,
666 assert_debug_snapshot!(&runnables, 657 &[&TEST, &TEST],
667 @r###" 658 expect![[r#"
668 [ 659 [
669 Runnable { 660 Runnable {
670 nav: NavigationTarget { 661 nav: NavigationTarget {
671 file_id: FileId( 662 file_id: FileId(
672 1, 663 1,
673 ), 664 ),
674 full_range: 41..115, 665 full_range: 33..107,
675 name: "test_mod", 666 name: "test_mod",
676 kind: MODULE, 667 kind: MODULE,
677 focus_range: Some( 668 focus_range: Some(
678 45..53, 669 37..45,
679 ), 670 ),
680 container_name: None, 671 container_name: None,
681 description: None, 672 description: None,
682 docs: None, 673 docs: None,
683 }, 674 },
684 kind: TestMod { 675 kind: TestMod {
685 path: "foo::bar::test_mod", 676 path: "foo::bar::test_mod",
686 }, 677 },
687 cfg_exprs: [], 678 cfg_exprs: [],
688 }, 679 },
689 Runnable { 680 Runnable {
690 nav: NavigationTarget { 681 nav: NavigationTarget {
691 file_id: FileId( 682 file_id: FileId(
692 1, 683 1,
693 ), 684 ),
694 full_range: 68..105, 685 full_range: 60..97,
695 name: "test_foo1", 686 name: "test_foo1",
696 kind: FN_DEF, 687 kind: FN_DEF,
697 focus_range: Some( 688 focus_range: Some(
698 91..100, 689 83..92,
699 ), 690 ),
700 container_name: None, 691 container_name: None,
701 description: None, 692 description: None,
702 docs: None, 693 docs: None,
703 }, 694 },
704 kind: Test { 695 kind: Test {
705 test_id: Path( 696 test_id: Path(
706 "foo::bar::test_mod::test_foo1", 697 "foo::bar::test_mod::test_foo1",
707 ), 698 ),
708 attr: TestAttr { 699 attr: TestAttr {
709 ignore: false, 700 ignore: false,
701 },
702 },
703 cfg_exprs: [],
710 }, 704 },
711 }, 705 ]
712 cfg_exprs: [], 706 "#]],
713 }, 707 );
714 ]
715 "###
716 );
717 assert_actions(&runnables, &[&TEST, &TEST]);
718 } 708 }
719 709
720 #[test] 710 #[test]
721 fn test_runnables_with_feature() { 711 fn test_runnables_with_feature() {
722 let (analysis, pos) = analysis_and_position( 712 check(
723 r#" 713 r#"
724 //- /lib.rs crate:foo cfg:feature=foo 714//- /lib.rs crate:foo cfg:feature=foo
725 <|> //empty 715<|>
726 #[test] 716#[test]
727 #[cfg(feature = "foo")] 717#[cfg(feature = "foo")]
728 fn test_foo1() {} 718fn test_foo1() {}
729 "#, 719"#,
730 ); 720 &[&TEST],
731 let runnables = analysis.runnables(pos.file_id).unwrap(); 721 expect![[r#"
732 assert_debug_snapshot!(&runnables, 722 [
733 @r###" 723 Runnable {
734 [ 724 nav: NavigationTarget {
735 Runnable { 725 file_id: FileId(
736 nav: NavigationTarget { 726 1,
737 file_id: FileId( 727 ),
738 1, 728 full_range: 1..50,
739 ), 729 name: "test_foo1",
740 full_range: 1..58, 730 kind: FN_DEF,
741 name: "test_foo1", 731 focus_range: Some(
742 kind: FN_DEF, 732 36..45,
743 focus_range: Some( 733 ),
744 44..53, 734 container_name: None,
745 ), 735 description: None,
746 container_name: None, 736 docs: None,
747 description: None, 737 },
748 docs: None, 738 kind: Test {
749 }, 739 test_id: Path(
750 kind: Test { 740 "test_foo1",
751 test_id: Path( 741 ),
752 "test_foo1", 742 attr: TestAttr {
753 ), 743 ignore: false,
754 attr: TestAttr { 744 },
755 ignore: false, 745 },
756 }, 746 cfg_exprs: [
757 }, 747 KeyValue {
758 cfg_exprs: [ 748 key: "feature",
759 KeyValue { 749 value: "foo",
760 key: "feature", 750 },
761 value: "foo", 751 ],
762 }, 752 },
763 ], 753 ]
764 }, 754 "#]],
765 ] 755 );
766 "###
767 );
768 assert_actions(&runnables, &[&TEST]);
769 } 756 }
770 757
771 #[test] 758 #[test]
772 fn test_runnables_with_features() { 759 fn test_runnables_with_features() {
773 let (analysis, pos) = analysis_and_position( 760 check(
774 r#" 761 r#"
775 //- /lib.rs crate:foo cfg:feature=foo,feature=bar 762//- /lib.rs crate:foo cfg:feature=foo,feature=bar
776 <|> //empty 763<|>
777 #[test] 764#[test]
778 #[cfg(all(feature = "foo", feature = "bar"))] 765#[cfg(all(feature = "foo", feature = "bar"))]
779 fn test_foo1() {} 766fn test_foo1() {}
780 "#, 767"#,
781 ); 768 &[&TEST],
782 let runnables = analysis.runnables(pos.file_id).unwrap(); 769 expect![[r#"
783 assert_debug_snapshot!(&runnables, 770 [
784 @r###" 771 Runnable {
785 [ 772 nav: NavigationTarget {
786 Runnable { 773 file_id: FileId(
787 nav: NavigationTarget { 774 1,
788 file_id: FileId( 775 ),
789 1, 776 full_range: 1..72,
790 ), 777 name: "test_foo1",
791 full_range: 1..80, 778 kind: FN_DEF,
792 name: "test_foo1", 779 focus_range: Some(
793 kind: FN_DEF, 780 58..67,
794 focus_range: Some( 781 ),
795 66..75, 782 container_name: None,
796 ), 783 description: None,
797 container_name: None, 784 docs: None,
798 description: None, 785 },
799 docs: None, 786 kind: Test {
800 }, 787 test_id: Path(
801 kind: Test { 788 "test_foo1",
802 test_id: Path( 789 ),
803 "test_foo1", 790 attr: TestAttr {
804 ), 791 ignore: false,
805 attr: TestAttr {
806 ignore: false,
807 },
808 },
809 cfg_exprs: [
810 All(
811 [
812 KeyValue {
813 key: "feature",
814 value: "foo",
815 },
816 KeyValue {
817 key: "feature",
818 value: "bar",
819 }, 792 },
793 },
794 cfg_exprs: [
795 All(
796 [
797 KeyValue {
798 key: "feature",
799 value: "foo",
800 },
801 KeyValue {
802 key: "feature",
803 value: "bar",
804 },
805 ],
806 ),
820 ], 807 ],
821 ), 808 },
822 ], 809 ]
823 }, 810 "#]],
824 ] 811 );
825 "###
826 );
827 assert_actions(&runnables, &[&TEST]);
828 } 812 }
829 813
830 #[test] 814 #[test]
831 fn test_runnables_no_test_function_in_module() { 815 fn test_runnables_no_test_function_in_module() {
832 let (analysis, pos) = analysis_and_position( 816 check(
833 r#" 817 r#"
834 //- /lib.rs 818//- /lib.rs
835 <|> //empty 819<|>
836 mod test_mod { 820mod test_mod {
837 fn foo1() {} 821 fn foo1() {}
838 } 822}
839 "#, 823"#,
824 &[],
825 expect![[r#"
826 []
827 "#]],
840 ); 828 );
841 let runnables = analysis.runnables(pos.file_id).unwrap();
842 assert!(runnables.is_empty())
843 } 829 }
844} 830}