From c82669004fb2bc52a73c52a792311553b5d30a02 Mon Sep 17 00:00:00 2001 From: yusyus Date: Mon, 2 Feb 2026 22:28:06 +0300 Subject: [PATCH] fix: Add GDScript regex patterns for test example extraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PROBLEM: - Test files discovered but extraction failed - WARNING: Language GDScript not supported for regex extraction - PATTERNS dictionary missing GDScript entry SOLUTION: Added GDScript patterns to PATTERNS dictionary: 1. test_function pattern: - Matches GUT: func test_something() - Matches gdUnit4: @test\nfunc test_something() - Pattern: r"(?:@test\s+)?func\s+(test_\w+)\s*\(" 2. instantiation pattern: - var obj = Class.new() - var obj = preload("res://path").new() - var obj = load("res://path").new() - Pattern: r"(?:var|const)\s+(\w+)\s*=\s*(?:(\w+)\.new\(|(?:preload|load)\([\"']([^\"']+)[\"']\)\.new\()" 3. assertion pattern: - GUT assertions: assert_eq, assert_true, assert_false, etc. - gdUnit4 assertions: assert_that, assert_str, etc. - Pattern: r"assert_(?:eq|ne|true|false|null|not_null|gt|lt|between|has|contains|typeof)\(([^)]+)\)" 4. signal pattern (bonus): - Signal connections: signal_name.connect() - Signal emissions: emit_signal("signal_name") - Pattern: r"(?:(\w+)\.connect\(|emit_signal\([\"'](\w+)[\"'])" IMPACT: - ✅ GDScript test files now extract examples - ✅ Supports GUT, gdUnit4, and WAT test frameworks - ✅ Extracts instantiation, assertion, and signal patterns FILE: test_example_extractor.py line 680-690 Co-Authored-By: Claude Sonnet 4.5 --- src/skill_seekers/cli/test_example_extractor.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/skill_seekers/cli/test_example_extractor.py b/src/skill_seekers/cli/test_example_extractor.py index 7763bb9..ec84e6f 100644 --- a/src/skill_seekers/cli/test_example_extractor.py +++ b/src/skill_seekers/cli/test_example_extractor.py @@ -9,9 +9,9 @@ Analyzes test files to extract meaningful code examples showing: - Setup patterns from fixtures/setUp() - Multi-step workflows from integration tests -Supports 9 languages: +Supports 10 languages: - Python (AST-based, deep analysis) -- JavaScript, TypeScript, Go, Rust, Java, C#, PHP, Ruby (regex-based) +- JavaScript, TypeScript, Go, Rust, Java, C#, PHP, Ruby, GDScript (regex-based) Example usage: # Extract from directory @@ -676,6 +676,16 @@ class GenericTestAnalyzer: "assertion": r"expect\(([^)]+)\)\.to\s+(?:eq|be|match)\(([^)]+)\)", "test_function": r'(?:test|it)\s+["\']([^"\']+)["\']', }, + "gdscript": { + # GDScript object instantiation (var x = Class.new(), preload, load) + "instantiation": r"(?:var|const)\s+(\w+)\s*=\s*(?:(\w+)\.new\(|(?:preload|load)\([\"']([^\"']+)[\"']\)\.new\()", + # GUT/gdUnit4 assertions + "assertion": r"assert_(?:eq|ne|true|false|null|not_null|gt|lt|between|has|contains|typeof)\(([^)]+)\)", + # Test functions: GUT (func test_*), gdUnit4 (@test), WAT (extends WAT.Test) + "test_function": r"(?:@test\s+)?func\s+(test_\w+)\s*\(", + # Signal connections and emissions + "signal": r"(?:(\w+)\.connect\(|emit_signal\([\"'](\w+)[\"'])", + }, } # Language name normalization mapping