content:"---\nname: test-skill\ndescription: A test skill\n---\n\n# Skill Content",
expectedName:"test-skill",
expectedDesc:"A test skill",
},
{
name:"windows-line-endings",
lineEndingType:"Windows (\\r\\n)",
content:"---\r\nname: test-skill\r\ndescription: A test skill\r\n---\r\n\r\n# Skill Content",
expectedName:"test-skill",
expectedDesc:"A test skill",
},
{
name:"classic-mac-line-endings",
lineEndingType:"Classic Mac (\\r)",
content:"---\rname: test-skill\rdescription: A test skill\r---\r\r# Skill Content",
expectedName:"test-skill",
expectedDesc:"A test skill",
},
}
for_,tc:=rangetestcases{
t.Run(tc.name,func(t*testing.T){
// Extract frontmatter
frontmatter:=sl.extractFrontmatter(tc.content)
assert.NotEmpty(t,frontmatter,"Frontmatter should be extracted for %s line endings",tc.lineEndingType)
// Parse YAML to get name and description (parseSimpleYAML now handles all line ending types)
yamlMeta:=sl.parseSimpleYAML(frontmatter)
assert.Equal(t,tc.expectedName,yamlMeta["name"],"Name should be correctly parsed from frontmatter with %s line endings",tc.lineEndingType)
assert.Equal(t,tc.expectedDesc,yamlMeta["description"],"Description should be correctly parsed from frontmatter with %s line endings",tc.lineEndingType)
})
}
}
funcTestStripFrontmatter(t*testing.T){
sl:=&SkillsLoader{}
testcases:=[]struct{
namestring
contentstring
expectedContentstring
lineEndingTypestring
}{
{
name:"unix-line-endings",
lineEndingType:"Unix (\\n)",
content:"---\nname: test-skill\ndescription: A test skill\n---\n\n# Skill Content",
expectedContent:"# Skill Content",
},
{
name:"windows-line-endings",
lineEndingType:"Windows (\\r\\n)",
content:"---\r\nname: test-skill\r\ndescription: A test skill\r\n---\r\n\r\n# Skill Content",
expectedContent:"# Skill Content",
},
{
name:"classic-mac-line-endings",
lineEndingType:"Classic Mac (\\r)",
content:"---\rname: test-skill\rdescription: A test skill\r---\r\r# Skill Content",