MCPcopy Create free account
hub / github.com/chainreactors/spray / TestAddCustomExtractor

Function TestAddCustomExtractor

pkg/proton_test.go:332–349  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

330}
331
332func TestAddCustomExtractor(t *testing.T) {
333 mustLoadTemplates(t)
334
335 AddCustomExtractor("version", `version[:\s]+(\d+\.\d+\.\d+)`)
336 defer EnableExtractors(nil)
337
338 if !IsProtonExtractor("custom-version") {
339 t.Error("custom extractor not found by ID")
340 }
341
342 body := []byte(`<html>version: 2.1.0</html>`)
343 EnableExtractors([]string{"custom-version"})
344 results := ProtonExtract(body)
345
346 if len(results) == 0 {
347 t.Fatal("custom extractor returned no results")
348 }
349}
350
351func TestProtonExtractSeverity(t *testing.T) {
352 mustLoadTemplates(t)

Callers

nothing calls this directly

Calls 6

mustLoadTemplatesFunction · 0.85
AddCustomExtractorFunction · 0.85
EnableExtractorsFunction · 0.85
IsProtonExtractorFunction · 0.85
ProtonExtractFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected