Skip to main content

Crate gdtest_analysis

Crate gdtest_analysis 

Source
Expand description

Discovery helpers for gdtest.

Two layers:

  1. resolve turns user-supplied paths (files, directories, res://…) into a flat list of res://… paths, filtered by discovery include/exclude globs.
  2. list_tests_in parses one GDScript file with gdsyntax and returns every func test_*() name in source order.

Default patterns:

  • test/**/*.gd — any .gd file inside a test/ directory tree
  • **/*.test.gd — co-located test files anywhere in the project

Users can override via gdtest.toml: include = ["test/**/*.gd", "**/*.test.gd"]

When walking a folder, hidden folders (.godot, .git…), addons, folders with a .gdignore, and nested Godot projects are skipped, as the Godot editor does, so an addon’s own tests never run as the project’s. A folder or file named directly is always used.

Target: discovering 500 tests across 50 files in <100 ms on a warm cache .

Re-exports§

pub use gdunit4_migrate::GdUnit4MigrationAction;
pub use gdunit4_migrate::GdUnit4MigrationIssue;
pub use gdunit4_migrate::GdUnit4MigrationOutput;
pub use gdunit4_migrate::GdUnit4MigrationStatus;
pub use gdunit4_migrate::is_gdunit4_test_file;
pub use gdunit4_migrate::is_gdunit4_test_source;
pub use gdunit4_migrate::migrate_gdunit4_file;
pub use gdunit4_migrate::migrate_gdunit4_source;
pub use gut_migrate::GutMigrationAction;
pub use gut_migrate::GutMigrationIssue;
pub use gut_migrate::GutMigrationOutput;
pub use gut_migrate::GutMigrationStatus;
pub use gut_migrate::is_gut_test_file;
pub use gut_migrate::is_gut_test_source;
pub use gut_migrate::migrate_gut_file;
pub use gut_migrate::migrate_gut_source;
pub use rewrite::RewriteOutput;
pub use rewrite::rewrite_file;
pub use rewrite::rewrite_source;

Modules§

coverage
GDScript coverage instrumentation.
deps
GDScript dependency graph for test impact analysis.
gdunit4_migrate
gut_migrate
mutate
GDScript mutation testing operators.
rewrite
GDScript assert rewriter: preprocessing for pytest-style rich diffs.

Structs§

TestEntry
A discovered test function with its run classification.

Enums§

IsolationDirective
Per-test isolation override discovered from source comments.
TestKind
Classification of a discovered test function.

Constants§

DEFAULT_PATTERNS
Default discovery globs used when no include key is in gdtest.toml.

Functions§

extract_describe_dir
If path contains a component named describe_<Name>, return that component name. Used to prefix test function names for directory-based sub-suites.
glob_match
Match a relative path (forward-slash separated) against a simple glob pattern. Supports ** (zero or more path segments) and * (any chars within one segment).
list_test_entries_in
Return every func test_*() and func bench_*() in the given GDScript file, in source order.
list_test_entries_in_source
list_tests_in
Convenience wrapper: returns the names of tests that would actually run (excludes bench_*).
res_to_abs
Translate a res:// path to its on-disk absolute form.
resolve
Normalise every input path into a list of res://… test-file paths.
to_res_path
Translate an absolute on-disk path to the res:// form used by the worker. Caller guarantees file is inside project_abs.