package main import ( "testing" "github.com/dslipak/pdf" ) func TestCanReadResumeToString(t *testing.T) { resume, err := pdf.Open("HaydenHargreaves_Oct01.pdf") if err != nil { t.Errorf("err is not nil. Expected nil. %s", err.Error()) } if resume == nil { t.Error("resume is nil. Expected *pdf.Reader") } page := resume.Page(1) if page.V.IsNull() { t.Error("page.V is nil. Expected pdf.Value") } text, err := page.GetPlainText(nil) if err != nil { t.Errorf("err is not nil. Expected nil. %s", err.Error()) } if text == "" { t.Error("text is \"\". Expected content") } } func TestCannotReadResumeThatDoesNotExist(t *testing.T) { resume, err := pdf.Open("unknown.pdf") if err == nil { t.Error("err is nil. Expected not nil") } if resume != nil { t.Error("resume is bot nil. Expected nil") } }