MCPcopy
hub / github.com/perkeep/perkeep / TestStaticSocket

Function TestStaticSocket

pkg/schema/schema_test.go:634–665  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

632}
633
634func TestStaticSocket(t *testing.T) {
635 tdir := t.TempDir()
636
637 sockPath := filepath.Join(tdir, "socket")
638 err := osutil.Mksocket(sockPath)
639 if err == osutil.ErrNotSupported {
640 t.SkipNow()
641 }
642 if err != nil {
643 t.Fatalf("osutil.Mksocket(): %v", err)
644 }
645
646 fi, err := os.Lstat(sockPath)
647 if err != nil {
648 t.Fatalf("os.Lstat(): %v", err)
649 }
650
651 bb := NewCommonFileMap(sockPath, fi)
652 bb.SetType(TypeSocket)
653 bb.SetFileName(sockPath)
654 blob := bb.Blob()
655 t.Logf("Got JSON for socket: %s\n", blob.JSON())
656
657 sf, ok := blob.AsStaticFile()
658 if !ok {
659 t.Fatalf("Blob.AsStaticFile(): Expected true, got false")
660 }
661 _, ok = sf.AsStaticSocket()
662 if !ok {
663 t.Fatalf("StaticFile.AsStaticSocket(): Expected true, got false")
664 }
665}
666
667func TestTimezoneEXIFCorrection(t *testing.T) {
668 // Test that we get UTC times for photos taken in two

Callers

nothing calls this directly

Calls 11

MksocketFunction · 0.92
NewCommonFileMapFunction · 0.85
SetTypeMethod · 0.80
SetFileNameMethod · 0.80
LogfMethod · 0.80
AsStaticFileMethod · 0.80
AsStaticSocketMethod · 0.80
FatalfMethod · 0.65
LstatMethod · 0.65
BlobMethod · 0.65
JSONMethod · 0.45

Tested by

no test coverage detected