W3C home > Mailing lists > Public > www-ws-desc@w3.org > January 2007

Testcases for HTTP location grammar [CR130]

From: John Kaputin (gmail) <jakaputin@gmail.com>
Date: Thu, 11 Jan 2007 21:50:08 +0000
Message-ID: <4c2ae8f80701111350re5c934bned3ca0a7d3ca6cc8@mail.gmail.com>
To: "Philippe Le Hegaret" <plh@w3.org>, www-ws-desc@w3.org
Phillipe,
Today's working group call concluded that a grammar should define how the
http location is parsed and you have the action, so as discussed I'm sending
you some of my testcases. My post [1] is now captured as CR130.

In deciding on the grammatical rules, things to consider include the
precedence of double curly braces versus single braces and how to match
pairs of single braces - e.g. by scanning from left to right, by 'inner most
pair' (or whatever the terminology is), etc.

When trying several approaches in Woden I found it's not as simple as 'find
a left curly brace, check for a double brace, then scan for a right curly
brace'. Also, it appeared from my initial interpretation of the spec that
double curly braces should take precedence over single braces, but this
produced some unexpected results. A better approach seems to be 'inner most
pair' takes precedence, then double curly braces, then other single braces.

Below are some test cases using different approaches. "Valid/invalid" simply
indicates whether non-paired single braces end up in the parsed string
(literal single braces are okay).

Inner-most pair, then doubles, then unpaired singles. town=Paris:

"{town}"       > {town}           > "Paris"     > valid
"{{town}}"     > {,{town},}       > "{Paris}"   > invalid
"{{{town}}}"   > {{,{town},}}     > "{Paris}"   > valid
"{{{{town}}}}" > {{,{,{town},}},} > "{{Paris}}" > invalid
"{{town}"      > {,{town}         > "{Paris"    > invalid
"{{{town}"     > {{,{town}        > "{Paris"    > valid
"{town}}"      > {town},}         > "Paris}"    > invalid
"{town}}}"     > {town},}}        > "Paris}"    > valid

Double braces first, then pairs of singles left-to-right. town=Paris:

"{town}"       > {town}           > "Paris"     > valid
"{{town}}"     > {{,town,}}       > "{town}"    > valid
"{{{town}}}"   > {{,{,town,}},}   > "{{town}}"  > invalid
"{{{{town}}}}" > {{,{{,town,}},}} > "{{Paris}}" > invalid
"{{town}"      > {{,town,}        > "{town}"    > invalid
"{{{town}"     > {{,{town}        > "{Paris"    > valid
"{town}}"      > {,town,}}        > "{town}"    > invalid
"{town}}}"     > {,town,}},}      > "{town}}"   > invalid

Other test cases:

""                      (is an   empty string location valid?)
"/temperature/"
"/temperature/{town}/"
"/temperature/{town}/{state}/{country}"
"/temperature/{town}/{{{state}}}/{country}"

It would be good if the spec could include similar examples and/or if the
test suite covered the grammar.

regards,
John Kaputin

[1] http://lists.w3.org/Archives/Public/www-ws-desc/2007Jan/0045.html
Received on Thursday, 11 January 2007 21:50:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:58:45 GMT