package sync import "testing" func TestDebugHess(t *testing.T) { epubPath := "/home/nymusicman/Code/bookhoard/William L Hess/Crushing the Great Serpent_ Did God (42)/Crushing the Great Serpent_ Did - William L Hess.epub" c := NewCFIConverter(epubPath) xp, err := ParseCREXPointer("/body/DocFragment[5]/body/div[3]/p[28]/text().500") if err != nil { t.Fatal(err) } t.Logf("FragmentIndex: %d, CharOffset: %d", xp.FragmentIndex, xp.CharOffset) doc, href, err := c.getContentDoc(xp.FragmentIndex) if err != nil { t.Fatalf("getContentDoc error: %v", err) } t.Logf("href: %s", href) body := findBody(doc) if body == nil { t.Fatal("no body") } totalChars := countTextChars(body) t.Logf("total chars in doc: %d", totalChars) target, foundOffset := findNodeAtCharOffset(body, 500) if target == nil { t.Fatal("target is nil") } t.Logf("foundOffset: %d target: <%s>", foundOffset, target.Data) cfi, err := buildCFI(5, target, 0) t.Logf("cfi: %q err: %v", cfi, err) }