Files
codex/codex-rs/skills/src/parser_tests.rs
T
felixxia-oai 4c25d6cc5c Move executor skill bundle loading into the skills extension (#36877)
## What changed

- Move parsing of pre-discovered executor skill bundles from `core-skills` to
  the skills extension.
- Expose shared `SKILL.md` frontmatter parsing from `codex-skills` so direct
  and pre-discovered loading use the same validation and repair behavior.

## Testing

- Add parity coverage for direct and pre-discovered executor skill catalogs,
  including plugin namespaces, metadata, product policy, and warnings.
- Add a snapshot for the resulting pre-discovered executor catalog.

GitOrigin-RevId: c5f888226fa5600bd8b90f5682400da39a5db5ff
2026-08-04 10:41:01 +00:00

44 lines
1.3 KiB
Rust

use pretty_assertions::assert_eq;
use super::ParsedSkillFrontmatter;
use super::parse_skill_frontmatter_metadata;
#[test]
fn parses_repairs_and_sanitizes_frontmatter() {
let parsed = parse_skill_frontmatter_metadata(
"---\nname: deploy service\ndescription: Build for AWS: ECS\nmetadata:\n short-description: Deploy safely\n---\n",
|| "fallback".to_string(),
)
.expect("valid frontmatter");
assert_eq!(
parsed,
ParsedSkillFrontmatter {
name: "deploy service".to_string(),
description: "Build for AWS: ECS".to_string(),
short_description: Some("Deploy safely".to_string()),
}
);
}
#[test]
fn uses_default_name_and_requires_description() {
let parsed = parse_skill_frontmatter_metadata("---\ndescription: Demo skill\n---\n", || {
"demo".to_string()
})
.expect("valid frontmatter");
assert_eq!(
parsed,
ParsedSkillFrontmatter {
name: "demo".to_string(),
description: "Demo skill".to_string(),
short_description: None,
}
);
let error =
parse_skill_frontmatter_metadata("---\nname: demo\n---\n", || "fallback".to_string())
.expect_err("description should be required");
assert_eq!(error.to_string(), "missing field `description`");
}