MCPcopy Index your code
hub / github.com/larksuite/cli / TestIsLocalFileSrc

Function TestIsLocalFileSrc

shortcuts/mail/draft/patch_inline_resolve_test.go:653–682  ·  view source on GitHub ↗

--------------------------------------------------------------------------- helper unit tests ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

651// ---------------------------------------------------------------------------
652
653func TestIsLocalFileSrc(t *testing.T) {
654 tests := []struct {
655 src string
656 want bool
657 }{
658 {"./logo.png", true},
659 {"../images/logo.png", true},
660 {"logo.png", true},
661 {"/absolute/path/logo.png", true},
662 {`C:\images\logo.png`, false},
663 {"C:/images/logo.png", false},
664 {`c:\path\file.png`, false},
665 {"cid:logo", false},
666 {"CID:logo", false},
667 {"http://example.com/img.png", false},
668 {"https://example.com/img.png", false},
669 {"data:image/png;base64,abc", false},
670 {"//cdn.example.com/a.png", false},
671 {"blob:https://example.com/uuid", false},
672 {"ftp://example.com/file.png", false},
673 {"file:///local/file.png", false},
674 {"mailto:test@example.com", false},
675 {"", false},
676 }
677 for _, tt := range tests {
678 if got := isLocalFileSrc(tt.src); got != tt.want {
679 t.Errorf("isLocalFileSrc(%q) = %v, want %v", tt.src, got, tt.want)
680 }
681 }
682}
683
684func TestGenerateCID(t *testing.T) {
685 seen := make(map[string]bool)

Callers

nothing calls this directly

Calls 1

isLocalFileSrcFunction · 0.85

Tested by

no test coverage detected