Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
c8530d02
Commit
c8530d02
authored
6 years ago
by
Christian Semmler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test case for remote ref issue
parent
8a6c345b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
schematest.cpp
test/unittest/schematest.cpp
+29
-0
No files found.
test/unittest/schematest.cpp
View file @
c8530d02
...
...
@@ -2004,6 +2004,35 @@ TEST(SchemaValidator, Ref_remote) {
SchemaValidatorType
,
PointerType
);
}
TEST
(
SchemaValidator
,
Ref_remote_issue1210
)
{
class
SchemaDocumentProvider
:
public
IRemoteSchemaDocumentProvider
{
SchemaDocument
**
collection
;
public
:
SchemaDocumentProvider
(
SchemaDocument
**
collection
)
:
collection
(
collection
)
{
}
virtual
const
SchemaDocument
*
GetRemoteDocument
(
const
char
*
uri
,
SizeType
length
)
{
int
i
=
0
;
while
(
collection
[
i
]
&&
typename
SchemaDocument
::
URIType
(
uri
,
length
)
!=
collection
[
i
]
->
GetURI
())
++
i
;
return
collection
[
i
];
}
};
SchemaDocument
*
collection
[]
{
0
,
0
,
0
};
SchemaDocumentProvider
provider
(
collection
);
Document
x
,
y
,
z
;
x
.
Parse
(
"{
\"
properties
\"
:{
\"
country
\"
:{
\"
$ref
\"
:
\"
y.json#/definitions/country_remote
\"
}},
\"
type
\"
:
\"
object
\"
}"
);
y
.
Parse
(
"{
\"
definitions
\"
:{
\"
country_remote
\"
:{
\"
$ref
\"
:
\"
z.json#/definitions/country_list
\"
}}}"
);
z
.
Parse
(
"{
\"
definitions
\"
:{
\"
country_list
\"
:{
\"
enum
\"
:[
\"
US
\"
]}}}"
);
SchemaDocument
sz
(
z
,
"z.json"
,
6
,
&
provider
);
collection
[
0
]
=
&
sz
;
SchemaDocument
sy
(
y
,
"y.json"
,
6
,
&
provider
);
collection
[
1
]
=
&
sy
;
SchemaDocument
sx
(
x
,
"x.json"
,
6
,
&
provider
);
VALIDATE
(
sx
,
"{
\"
country
\"
:
\"
UK
\"
}"
,
false
);
VALIDATE
(
sx
,
"{
\"
country
\"
:
\"
US
\"
}"
,
true
);
}
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment