Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipptoolfile man page: Document method to reference collection members and logical operators for predicates #32

Closed
wifiprintguy opened this issue Oct 14, 2022 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@wifiprintguy
Copy link

(Moved here from istopwg/ippsample Issue #274 (istopwg/ippsample#274)

The man page for ipptoolfile doesn't seem to clearly include a description of how a test can reference a particular member within a collection, nor does it document what logical operators can be used for the values.

For members of a collection, a "path" is used, like so:

EXPECT finishings-col/baling OF-TYPE collection

It also isn't clear what logical operators the author of a .test file could use in a predicate. For instance, they might want to include an EXPECT directive like so:

EXPECT uri-authentication-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE 'basic' | 'certificate' | 'digest' | 'negotiate' | 'OAuth 2.0'

(If the latter isn't possible then I'll file a separate enhancement request...)

@michaelrsweet
Copy link
Member

OK, so the current man page already says:

Attribute names can specify member attributes by separating the attribute and member names with the forward slash, for example "media-col/media-size/x-dimension".

But I've added an examples section at the bottom of the ipptoolfile man page:

EXAMPLES

Query the "foo-default" and "foo-supported" Printer Description attributes and validate that all of its values are 'bar', 'baz', or 'none':

{
  NAME "Validate 'foo' Attribute"
  OPERATION Get-Printer-Attributes
  GROUP operation-attributes-tag
  ATTR charset attributes-charset utf-8
  ATTR language attributes-natural-language en
  ATTR uri printer-uri $uri
  ATTR keyword requested-attributes media-col-ready
  EXPECT foo-default OF-TYPE keyword IN-GROUP printer-attributes-tag
      COUNT 1 WITH-VALUE "/^(bar|baz|none)$$/"
  EXPECT foo-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
      WITH-ALL-VALUES "/^(bar|baz|none)$$/"
}

Query the "media-col-ready" Printer Status attribute and validate that the collection values contain "media-size" and "media-source" member attributes:

{
  NAME "Validate 'foo' Attribute"
  OPERATION Get-Printer-Attributes
  GROUP operation-attributes-tag
  ATTR charset attributes-charset utf-8
  ATTR language attributes-natural-language en
  ATTR uri printer-uri $uri
  ATTR keyword requested-attributes foo-default,foo-supported
  EXPECT media-col-ready OF-TYPE collection IN-GROUP printer-attributes-tag
  EXPECT-ALL media-col-ready/media-size OF-TYPE collection COUNT 1
  EXPECT-ALL media-col-ready/media-size/x-dimension OF-TYPE integer(1:MAX) COUNT 1
  EXPECT-ALL media-col-ready/media-size/y-dimension OF-TYPE integer(0:MAX) COUNT 1
  EXPECT-ALL media-col-ready/media-source OF-TYPE keyword|name COUNT 1
}

@michaelrsweet michaelrsweet self-assigned this Jan 19, 2023
@michaelrsweet michaelrsweet added this to the v3.0 milestone Jan 19, 2023
@michaelrsweet michaelrsweet added the documentation Improvements or additions to documentation label Jan 19, 2023
@michaelrsweet
Copy link
Member

[master 606e9cc] Add examples to ipptoolfile man page (Issue #32)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants