{
- "variables" : {
- "e" : "20% tricky",
- "a" : "fred",
- "scheme" : "https",
- "d" : "one two three",
- "20" : "this-is-spinal-tap",
- "p" : "quote=to+be+or+not+to+be",
- "c" : "cheeseburger",
- "q" : "hullo#world",
- "b" : "barney",
- "f" : ""
- },
- "tests" : [
- {
- "template" : "http://example.org/page1#{a}",
- "expected" : "http://example.org/page1#fred"
- },
- {
- "template" : "http://example.org/{a}/{b}/",
- "expected" : "http://example.org/fred/barney/"
- },
- {
- "template" : "http://example.org/{a}{b}/",
- "expected" : "http://example.org/fredbarney/"
- },
- {
- "template" : "http://example.com/order/{c}/{c}/{c}/",
- "expected" : "http://example.com/order/cheeseburger/cheeseburger/cheeseburger/"
- },
- {
- "template" : "http://example.org/{d}",
- "expected" : "http://example.org/one%20two%20three"
- },
- {
- "template" : "http://example.org/{e}",
- "expected" : "http://example.org/20%25%20tricky"
- },
- {
- "template" : "http://example.com/{f}/",
- "expected" : "http://example.com//"
- },
- {
- "template" : "{scheme}://{20}.example.org?date={wilma}&option={a}",
- "expected" : "https://this-is-spinal-tap.example.org?date=&option=fred"
- },
- {
- "template" : "http://example.org?{p}",
- "expected" : "http://example.org?quote=to+be+or+not+to+be"
- },
- {
- "template" : "http://example.com/{q}",
- "expected" : "http://example.com/hullo#world"
- }
- ]
+ "variables": {
+ "foo" : "\u03d3",
+ "bar" : "fred",
+ "baz" : "10,20,30",
+ "qux" : ["10","20","30"],
+ "corge" : [],
+ "grault" : "",
+ "garply" : "a/b/c",
+ "waldo" : "ben & jerrys",
+ "fred" : ["fred", "", "wilma"],
+ "plugh" : ["\u017F\u0307", "\u0073\u0307"],
+ "1-a_b.c": 200
+ },
+
+ "tests": [
+ {
+ "template": "http://example.org/?q={bar}",
+ "expected": "http://example.org/?q=fred"
+ },
+
+ {
+ "template": "/{xyzzy}",
+ "expected": "/"
+ },
+
+ {
+ "template": "http://example.org/?{-join|&|foo,bar,xyzzy,baz}",
+ "expected": "http://example.org/?foo=%CE%8E&bar=fred&baz=10%2C20%2C30"
+ },
+
+ {
+ "template": "http://example.org/?d={-list|,|qux}",
+ "expected": "http://example.org/?d=10,20,30"
+ },
+
+ {
+ "template": "http://example.org/?d={-list|&d=|qux}",
+ "expected": "http://example.org/?d=10&d=20&d=30"
+ },
+
+ {
+ "template": "http://example.org/{bar}{bar}/{garply}",
+ "expected": "http://example.org/fredfred/a%2Fb%2Fc"
+ },
+
+ {
+ "template": "http://example.org/{bar}{-prefix|/|fred}",
+ "expected": "http://example.org/fred/fred//wilma"
+ },
+
+ {
+ "template": "{-neg|:|corge}{-suffix|:|plugh}",
+ "expected": ":%E1%B9%A1:%E1%B9%A1:"
+ },
+
+ {
+ "template": "../{waldo}/",
+ "expected": "../ben%20%26%20jerrys/"
+ },
+
+ {
+ "template": "telnet:192.0.2.16{-opt|:80|grault}",
+ "expected": "telnet:192.0.2.16:80"
+ },
+
+ {
+ "template": ":{1-a_b.c}:",
+ "expected": ":200:"
+ }
+ ]
}