You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
content: "---\nname: test-skill\ndescription: A test skill\n---\n\n# Skill Content",
93
+
expectedName: "test-skill",
94
+
expectedDesc: "A test skill",
95
+
},
96
+
{
97
+
name: "windows-line-endings",
98
+
lineEndingType: "Windows (\\r\\n)",
99
+
content: "---\r\nname: test-skill\r\ndescription: A test skill\r\n---\r\n\r\n# Skill Content",
100
+
expectedName: "test-skill",
101
+
expectedDesc: "A test skill",
102
+
},
103
+
{
104
+
name: "classic-mac-line-endings",
105
+
lineEndingType: "Classic Mac (\\r)",
106
+
content: "---\rname: test-skill\rdescription: A test skill\r---\r\r# Skill Content",
107
+
expectedName: "test-skill",
108
+
expectedDesc: "A test skill",
109
+
},
110
+
}
111
+
112
+
for_, tc:=rangetestcases {
113
+
t.Run(tc.name, func(t*testing.T) {
114
+
// Extract frontmatter
115
+
frontmatter:=sl.extractFrontmatter(tc.content)
116
+
assert.NotEmpty(t, frontmatter, "Frontmatter should be extracted for %s line endings", tc.lineEndingType)
117
+
118
+
// Parse YAML to get name and description (parseSimpleYAML now handles all line ending types)
119
+
yamlMeta:=sl.parseSimpleYAML(frontmatter)
120
+
assert.Equal(t, tc.expectedName, yamlMeta["name"], "Name should be correctly parsed from frontmatter with %s line endings", tc.lineEndingType)
121
+
assert.Equal(t, tc.expectedDesc, yamlMeta["description"], "Description should be correctly parsed from frontmatter with %s line endings", tc.lineEndingType)
122
+
})
123
+
}
124
+
}
125
+
126
+
funcTestStripFrontmatter(t*testing.T) {
127
+
sl:=&SkillsLoader{}
128
+
129
+
testcases:= []struct {
130
+
namestring
131
+
contentstring
132
+
expectedContentstring
133
+
lineEndingTypestring
134
+
}{
135
+
{
136
+
name: "unix-line-endings",
137
+
lineEndingType: "Unix (\\n)",
138
+
content: "---\nname: test-skill\ndescription: A test skill\n---\n\n# Skill Content",
139
+
expectedContent: "# Skill Content",
140
+
},
141
+
{
142
+
name: "windows-line-endings",
143
+
lineEndingType: "Windows (\\r\\n)",
144
+
content: "---\r\nname: test-skill\r\ndescription: A test skill\r\n---\r\n\r\n# Skill Content",
145
+
expectedContent: "# Skill Content",
146
+
},
147
+
{
148
+
name: "classic-mac-line-endings",
149
+
lineEndingType: "Classic Mac (\\r)",
150
+
content: "---\rname: test-skill\rdescription: A test skill\r---\r\r# Skill Content",
0 commit comments