MCPcopy Create free account
hub / github.com/FastLED/FastLED / list_test_cases

Function list_test_cases

mcp_server.py:644–716  ·  view source on GitHub ↗

List TEST_CASEs in FastLED test files.

(
    arguments: dict[str, Any], project_root: Path
)

Source from the content-addressed store, hash-verified

642
643
644async def list_test_cases(
645 arguments: dict[str, Any], project_root: Path
646) -> CallToolResult:
647 """List TEST_CASEs in FastLED test files."""
648 test_file = arguments.get("test_file")
649 search_pattern = arguments.get("search_pattern", "")
650
651 tests_dir = project_root / "tests"
652
653 if not tests_dir.exists():
654 return CallToolResult(
655 content=[TextContent(type="text", text="Tests directory not found")],
656 isError=True,
657 )
658
659 test_cases: dict[str, list[str]] = {}
660
661 if test_file:
662 # Analyze specific test file
663 test_path = tests_dir / f"test_{test_file}.cpp"
664 if not test_path.exists():
665 return CallToolResult(
666 content=[
667 TextContent(
668 type="text", text=f"Test file not found: test_{test_file}.cpp"
669 )
670 ],
671 isError=True,
672 )
673 test_cases[test_file] = extract_test_cases(test_path, search_pattern)
674 else:
675 # Analyze all test files
676 for test_path in tests_dir.glob("test_*.cpp"):
677 test_name = test_path.stem[5:] # Remove "test_" prefix
678 cases = extract_test_cases(test_path, search_pattern)
679 if cases: # Only include files with test cases
680 test_cases[test_name] = cases
681
682 # Format output
683 if not test_cases:
684 return CallToolResult(
685 content=[
686 TextContent(type="text", text="No TEST_CASEs found matching criteria")
687 ]
688 )
689
690 result_text = "FastLED TEST_CASEs:\n"
691 result_text += "=" * 50 + "\n\n"
692
693 total_cases = 0
694 for test_name, cases in sorted(test_cases.items()):
695 result_text += f"📁 {test_name} ({len(cases)} TEST_CASEs):\n"
696 for i, case in enumerate(cases, 1):
697 result_text += f" {i:2d}. {case}\n"
698 result_text += "\n"
699 total_cases += len(cases)
700
701 result_text += f"Total: {total_cases} TEST_CASEs across {len(test_cases)} files\n\n"

Callers 1

call_toolFunction · 0.85

Calls 5

extract_test_casesFunction · 0.85
listClass · 0.85
itemsMethod · 0.80
getMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected