-
Notifications
You must be signed in to change notification settings - Fork 25
Add syntax tests for codepoint escaping. #151
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
Open
kasei
wants to merge
1
commit into
w3c:main
Choose a base branch
from
kasei:sparql-syntax-codepoint-escaping
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
\u0041\u0053\u004B\u0020\u007B\u007D | ||
|
||
# The query `ASK {}` entirely encoded using codepoint escapes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PREFIX ns: <http://example.org/> | ||
SELECT * WHERE { | ||
?s ?p ns:id\u005c=123 | ||
} | ||
|
||
# the escape here produces '\' REVERSE SOLIDUS (U+5C) | ||
# its unescaping must lead to a Prefixed Name ns:id\=123 using an escaped | ||
# equals sign (U+3D), representing the IRI <http://example.org/id=123>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT * WHERE { | ||
?s ?p "\\u0074" | ||
} | ||
# Legal codepoint escape of LATIN SMALL LETTER T (U+74), resulting in a | ||
# valid backslash escape \t for CHARACTER TABULATION (U+9). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT * WHERE { | ||
?s ?p "\u005C\u005Cn" | ||
} | ||
# Two legal codepoint escapes of REVERSE SOLIDUS (U+5C), resulting in a | ||
# valid backslash escape \\ for REVERSE SOLIDUS (U+5C) followed by 'n'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PREFIX og: <http://ogp.me/ns#> | ||
SELECT * WHERE { | ||
?page og:audio\u00253Atitle ?title | ||
} | ||
|
||
# the escape here produces '%' PERCENT SIGN (U+25) | ||
# its unescaping must lead to a Prefixed Name og:audio%3Atitle which includes | ||
# the percent-encoding %3A (COLON). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SELECT\u0020*\U00000009WHERE { | ||
?s ?p "value" | ||
} | ||
|
||
# the escapes here produce whitespace -- SPACESPACE (U+20) and | ||
# CHARACTER TABULATION (U+9) -- surrounding the `*` token in the | ||
# SELECT projection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SELECT * WHERE { | ||
?s ?p \u0022value" | ||
} | ||
|
||
# the escape here produces QUOTATION MARK (U+22) | ||
# its unescaping must lead to the literal 'value'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
SELECT * WHERE { | ||
?s ?p "\\u0041" | ||
} | ||
# Legal codepoint escape of LATIN CAPITAL LETTER A (U+41), resulting in an | ||
# invalid backslash escape \A. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix : <https://w3c.github.io/rdf-tests/sparql/sparql12/escaping#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . | ||
@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> . | ||
@prefix dawgt: <http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#> . | ||
|
||
:manifest rdf:type mf:Manifest ; | ||
rdfs:label "SPARQL Codepoint-Escaping Tests" ; | ||
mf:entries | ||
( | ||
:codepoint-esc-01 | ||
:codepoint-esc-02 | ||
:codepoint-esc-bad-03 | ||
:codepoint-esc-04 | ||
:codepoint-esc-05 | ||
:codepoint-esc-06 | ||
:codepoint-esc-07 | ||
:codepoint-esc-08 | ||
) . | ||
|
||
|
||
:codepoint-esc-01 rdf:type mf:PositiveSyntaxTest ; | ||
dawgt:approval dawgt:Proposed ; | ||
mf:name "codepoint-esc-01.rq" ; | ||
mf:action <codepoint-esc-01.rq> . | ||
|
||
:codepoint-esc-02 rdf:type mf:PositiveSyntaxTest ; | ||
dawgt:approval dawgt:Proposed ; | ||
mf:name "codepoint-esc-02.rq" ; | ||
rdfs:comment "codepoint escape for the backslash of a PN_LOCAL_ESC in the PN_LOCAL part of a PrefixedName" ; | ||
mf:action <codepoint-esc-02.rq> . | ||
|
||
:codepoint-esc-bad-03 rdf:type mf:NegativeSyntaxTest ; | ||
dawgt:approval dawgt:Proposed ; | ||
mf:name "codepoint-esc-bad-03.rq" ; | ||
rdfs:comment "codepoint escape that results in an invalid backslash escape (requires handling codepoint escaping before backslash escaping)" ; | ||
mf:action <codepoint-esc-bad-03.rq> . | ||
|
||
:codepoint-esc-04 rdf:type mf:PositiveSyntaxTest ; | ||
dawgt:approval dawgt:Proposed ; | ||
mf:name "codepoint-esc-04.rq" ; | ||
rdfs:comment "codepoint escape that results in a valid backslash escape" ; | ||
mf:action <codepoint-esc-04.rq> . | ||
|
||
:codepoint-esc-05 rdf:type mf:PositiveSyntaxTest ; | ||
dawgt:approval dawgt:Proposed ; | ||
mf:name "codepoint-esc-05.rq" ; | ||
mf:action <codepoint-esc-05.rq> . | ||
|
||
:codepoint-esc-06 rdf:type mf:PositiveSyntaxTest ; | ||
dawgt:approval dawgt:Proposed ; | ||
mf:name "codepoint-esc-06.rq" ; | ||
rdfs:comment "codepoint escape for the percent sign in the PL_LOCAL part of a PrefixedName" ; | ||
mf:action <codepoint-esc-06.rq> . | ||
|
||
:codepoint-esc-07 rdf:type mf:PositiveSyntaxTest ; | ||
dawgt:approval dawgt:Proposed ; | ||
mf:name "codepoint-esc-07.rq" ; | ||
rdfs:comment "codepoint escape for whitespace separating the projection tokens: SELECT * WHERE" ; | ||
mf:action <codepoint-esc-07.rq> . | ||
|
||
:codepoint-esc-08 rdf:type mf:PositiveSyntaxTest ; | ||
dawgt:approval dawgt:Proposed ; | ||
mf:name "codepoint-esc-08.rq" ; | ||
rdfs:comment "codepoint escape for the starting double-quote of a literal" ; | ||
mf:action <codepoint-esc-08.rq> . | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should indicate that these are related to the character stream processing. Calling them "escaping" is too general.
Suggestion:
syntax-escaping/
assyntax-char-stream-processing/
rdfs:label "Character Stream Processing Tests" ;
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@afs I can rename as requested, but unsure about the exact naming (and rdfs:label) here. "Codepoint Escape" is a term used in the spec, but I don't think we use anything similar to "Character Stream Processing". I'm obviously biased as the author here, but I think without context I'd be confused by what "Character Stream Processing Tests" were, but would have a pretty good idea about "Codepoint-Escaping Tests". Thoughts?