Harden scan robustness and tests

This commit is contained in:
ZacharyZcR
2026-06-13 07:55:37 +08:00
parent 1595c92aed
commit 15a7670ba2
100 changed files with 4483 additions and 412 deletions
+9
View File
@@ -386,6 +386,15 @@ func TestParsePort_PortGroups(t *testing.T) {
}
}
func TestParsePortGroupsRequireWholeToken(t *testing.T) {
if got := ParsePort("web8080"); len(got) != 0 {
t.Fatalf("ParsePort(web8080) = %v, want empty invalid token", got)
}
if got := ParsePort("web,8080"); len(got) == 0 || got[len(got)-1] != 28018 {
t.Fatalf("ParsePort(web,8080) = %v, want expanded web group", got)
}
}
// TestParsePort_WhitespaceHandling 测试空格处理
func TestParsePort_WhitespaceHandling(t *testing.T) {
tests := []struct {