diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-05-14 18:42:45 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-05-14 18:42:45 -0400 |
| commit | a694f64b1708183736a1b1b826e8890d354f5c2f (patch) | |
| tree | 3f72bda415c448628c492a4a671aeb9ea3dc30bf | |
| parent | 7ffc98c007601921db0677fc07c9779f71bb3499 (diff) | |
| download | lulu-a694f64b1708183736a1b1b826e8890d354f5c2f.zip | |
cli: test validate-cover and validate-interior-basic
| -rw-r--r-- | cmd/lulu/main.go | 11 | ||||
| -rw-r--r-- | cmd/lulu/testchecks/vc | 2 | ||||
| -rw-r--r-- | cmd/lulu/testchecks/vi_basic | 3 | ||||
| -rw-r--r-- | cmd/lulu/tests/vc | 1 | ||||
| -rw-r--r-- | cmd/lulu/tests/vi | 2 | ||||
| -rw-r--r-- | cmd/lulu/tests/vi_basic | 1 | ||||
| -rw-r--r-- | cover.go | 4 |
7 files changed, 19 insertions, 5 deletions
diff --git a/cmd/lulu/main.go b/cmd/lulu/main.go index 8d3527b..3ab4b8a 100644 --- a/cmd/lulu/main.go +++ b/cmd/lulu/main.go @@ -157,7 +157,6 @@ func validateInterior(name string, clnt *lulu.Client, args []string) { if len(val.ValidPkgIds) > 0 { fmt.Printf("valid %ss: %v\n", typeName(val.ValidPkgIds[0]), val.ValidPkgIds) } - for _, err := range val.Errors { lg.Printf("lulu error: %s\n", err) } @@ -189,7 +188,15 @@ func validateCover(name string, clnt *lulu.Client, args []string) { if err != nil { lg.Fatal(err) } - fmt.Println(val) // TODO: output format? + + fmt.Println("status:", val.Status) + fmt.Println("id:", val.Id) + for _, err := range val.Errors { + lg.Printf("lulu error: %s\n", err) + } + if len(val.Errors) > 0 || val.Status != lulu.CoverStatusNormalized { + os.Exit(1) + } } func coverDimensions(name string, clnt *lulu.Client, args []string) { diff --git a/cmd/lulu/testchecks/vc b/cmd/lulu/testchecks/vc new file mode 100644 index 0000000..c8404ed --- /dev/null +++ b/cmd/lulu/testchecks/vc @@ -0,0 +1,2 @@ +grep '^status: NORMALIZED$' <$1 +grep '^id: [1-9][0-9]*$' <$1 diff --git a/cmd/lulu/testchecks/vi_basic b/cmd/lulu/testchecks/vi_basic new file mode 100644 index 0000000..3293dbc --- /dev/null +++ b/cmd/lulu/testchecks/vi_basic @@ -0,0 +1,3 @@ +grep '^status: VALIDATED$' <$1 +grep '^id: [1-9][0-9]*$' <$1 +grep '^valid PkgIds: \[[A-Z0-9. ]\+\]$' <$1 diff --git a/cmd/lulu/tests/vc b/cmd/lulu/tests/vc new file mode 100644 index 0000000..f5859d3 --- /dev/null +++ b/cmd/lulu/tests/vc @@ -0,0 +1 @@ +lulu -s vc -mfg 0600X0900.BW.STD.PB.060UW444.MXX -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AADP367j0bTWlt8fCu-_tm2ia/161025/139056_cover.pdf?dl=1' -n 210 diff --git a/cmd/lulu/tests/vi b/cmd/lulu/tests/vi index 8a074c3..5ca8cc9 100644 --- a/cmd/lulu/tests/vi +++ b/cmd/lulu/tests/vi @@ -1 +1 @@ -lulu -s vi -mfg 0600X0900.BW.PRE.PB.060UW444.MXX -url https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1 -t 30s +lulu -s vi -mfg 0600X0900.BW.PRE.PB.060UW444.MXX -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1' -t 30s diff --git a/cmd/lulu/tests/vi_basic b/cmd/lulu/tests/vi_basic new file mode 100644 index 0000000..78cc8a8 --- /dev/null +++ b/cmd/lulu/tests/vi_basic @@ -0,0 +1 @@ +lulu -s vi -basic -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1' @@ -86,9 +86,9 @@ func (cd CoverDimensions) String() string { // CoverValidation contains the validation status of a cover file. type CoverValidation struct { - Id uint + Id uint `json:"id"` SrcUrl string `json:"source_url"` NPages uint `json:"page_count"` - Errors string + Errors []string `json:"errors"` Status CoverValidationStatus } |