Skip to content

Commit 3634bbe

Browse files
kaseigkellogg
authored andcommitted
Add syntax tests for unicode codepoint escapes.
1 parent 56b69db commit 3634bbe

File tree

6 files changed

+57
-1
lines changed

6 files changed

+57
-1
lines changed

sparql11/data-sparql11/syntax-query/manifest.ttl

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@prefix : <http://www.w3.org/2009/sparql/docs/tests/data-sparql11/syntax-query/manifest#> .
22
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
3-
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
44
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
55
@prefix mfx: <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> .
66
@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
@@ -103,6 +103,12 @@
103103
:test_pn_bad_13
104104

105105
:test_pp_coll
106+
107+
:test_codepoint_escape_01
108+
:test_codepoint_escape_02
109+
:test_codepoint_escape_03
110+
:test_codepoint_escape_bad_04
111+
:test_codepoint_escape_bad_05
106112
) .
107113

108114
:test_1 rdf:type mf:PositiveSyntaxTest11 ;
@@ -622,3 +628,30 @@
622628
dawgt:approvedBy <http://www.w3.org/2009/sparql/meeting/2012-08-07#resolution_2> ;
623629
mf:name "syn-pp-in-collection" ;
624630
mf:action <syn-pp-in-collection.rq> ;.
631+
632+
:test_codepoint_escape_01 rdf:type mf:PositiveSyntaxTest11 ;
633+
dawgt:approval dawgt:Proposed ;
634+
mf:name "\\U unicode codepoint escaping in literal" ;
635+
mf:action <syn-codepoint-escape-01.rq> ;.
636+
637+
:test_codepoint_escape_02 rdf:type mf:PositiveSyntaxTest11 ;
638+
dawgt:approval dawgt:Proposed ;
639+
mf:name "\\U unicode codepoint escaping in query syntax" ;
640+
mf:action <syn-codepoint-escape-02.rq> ;.
641+
642+
:test_codepoint_escape_03 rdf:type mf:PositiveSyntaxTest11 ;
643+
dawgt:approval dawgt:Proposed ;
644+
mf:name "\\U and \\u unicode codepoint escaping in variable name" ;
645+
mf:action <syn-codepoint-escape-03.rq> ;.
646+
647+
:test_codepoint_escape_bad_04 rdf:type mf:NegativeSyntaxTest11 ;
648+
dawgt:approval dawgt:Proposed ;
649+
mf:name "Invalid multi-pass codepoint escaping (\\u then \\U)" ;
650+
mf:description "Unescaping one escape sequence must not produce content that is used in another escape sequence" ;
651+
mf:action <syn-codepoint-escape-bad-04.rq> ;.
652+
653+
:test_codepoint_escape_bad_05 rdf:type mf:NegativeSyntaxTest11 ;
654+
dawgt:approval dawgt:Proposed ;
655+
mf:name "Invalid multi-pass codepoint escaping (\\U then \\u)" ;
656+
mf:description "Unescaping one escape sequence must not produce content that is used in another escape sequence" ;
657+
mf:action <syn-codepoint-escape-bad-05.rq> ;.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT * WHERE {
2+
?s ?p "\U0001f46a" .
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT \U0000002A WHERE \U0000007B # SELECT * WHERE {
2+
?s ?p true .
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT * WHERE {
2+
?s \u0024\U00000070 true . # ?s $p true
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT * WHERE {
2+
?s ?p \u005cU00000031 .
3+
}
4+
5+
# the first escape here produces '\' REVERSE SOLIDUS (U+5C)
6+
# its unescaping must not lead to a subsequent unescaping of "\U00000031" escape.
7+
# This should cause a syntax error as "?s ?p \u0031" and NOT a valid query as "?s ?p 1"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT * WHERE {
2+
?s ?p \U0000005cu0031 .
3+
}
4+
5+
# the first escape here produces '\' REVERSE SOLIDUS (U+5C)
6+
# its unescaping must not lead to a subsequent unescaping of "\u0031" escape.
7+
# This should cause a syntax error as "?s ?p \u0031" and NOT a valid query as "?s ?p 1"

0 commit comments

Comments
 (0)