README.md
1Theses test are borrowed from https://github.com/uri-templates/uritemplate-test
2at commit: fdd5d611a849b922c2ff40fc3997fd265dd14c02
3URI Template Tests
4==================
5
6This is a set of tests for implementations of
7[RFC6570](http://tools.ietf.org/html/rfc6570) - URI Template. It is designed
8to be reused by any implementation, to improve interoperability and
9implementation quality.
10
11If your project uses Git for version control, you can make uritemplate-tests into a [submodule](http://help.github.com/submodules/).
12
13Test Format
14-----------
15
16Each test file is a [JSON](http://tools.ietf.org/html/RFC6627) document
17containing an object whose properties are groups of related tests.
18Alternatively, all tests are available in XML as well, with the XML files
19being generated by transform-json-tests.xslt which uses json2xml.xslt as a
20general-purpose JSON-to-XML parsing library.
21
22Each group, in turn, is an object with three children:
23
24* level - the level of the tests covered, as per the RFC (optional; if absent,
25 assume level 4).
26* variables - an object representing the variables that are available to the
27 tests in the suite
28* testcases - a list of testcases, where each case is a two-member list, the
29 first being the template, the second being the result of expanding the
30 template with the provided variables.
31
32Note that the result string can be a few different things:
33
34* string - if the second member is a string, the result of expansion is
35 expected to match it, character-for-character.
36* list - if the second member is a list of strings, the result of expansion
37 is expected to match one of them; this allows for templates that can
38 expand into different, equally-acceptable URIs.
39* false - if the second member is boolean false, expansion is expected to
40 fail (i.e., the template was invalid).
41
42For example:
43
44 {
45 "Level 1 Examples" :
46 {
47 "level": 1,
48 "variables": {
49 "var" : "value",
50 "hello" : "Hello World!"
51 },
52 "testcases" : [
53 ["{var}", "value"],
54 ["{hello}", "Hello%20World%21"]
55 ]
56 }
57 }
58
59
60Tests Included
61--------------
62
63The following test files are included:
64
65* spec-examples.json - The complete set of example templates from the RFC
66* spec-examples-by-section.json - The examples, section by section
67* extended-tests.json - more complex test cases
68* negative-tests.json - invalid templates
69
70For all these test files, XML versions with the names *.xml can be
71generated with the transform-json-tests.xslt XSLT stylesheet. The XSLT
72contains the names of the above test files as a parameter, and can be
73started with any XML as input (i.e., the XML input is ignored).
74
75License
76-------
77
78 Copyright 2011-2012 The Authors
79
80 Licensed under the Apache License, Version 2.0 (the "License");
81 you may not use this file except in compliance with the License.
82 You may obtain a copy of the License at
83
84 http://www.apache.org/licenses/LICENSE-2.0
85
86 Unless required by applicable law or agreed to in writing, software
87 distributed under the License is distributed on an "AS IS" BASIS,
88 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89 See the License for the specific language governing permissions and
90 limitations under the License.
91
92