36 lines
880 B
Java
36 lines
880 B
Java
package com.easyagents.skill.util;
|
|
|
|
import com.easyagents.skill.exception.SkillValidationException;
|
|
import org.junit.Assert;
|
|
import org.junit.Test;
|
|
|
|
/**
|
|
* SkillPaths 安全规范化测试。
|
|
*/
|
|
public class SkillPathsTest {
|
|
|
|
/**
|
|
* 点路径段不能被静默剥离。
|
|
*/
|
|
@Test(expected = SkillValidationException.class)
|
|
public void rejectLeadingDotSegment() {
|
|
SkillPaths.normalize("./references/a.md");
|
|
}
|
|
|
|
/**
|
|
* 双向文本控制字符被拒绝。
|
|
*/
|
|
@Test(expected = SkillValidationException.class)
|
|
public void rejectBidiFormatCharacter() {
|
|
SkillPaths.normalize("references/a\u202Etxt.md");
|
|
}
|
|
|
|
/**
|
|
* Unicode 路径统一为 NFC。
|
|
*/
|
|
@Test
|
|
public void normalizeUnicodeToNfc() {
|
|
Assert.assertEquals("references/\u00e9.md", SkillPaths.normalize("references/e\u0301.md"));
|
|
}
|
|
}
|