X-Git-Url: http://erislabs.net/gitweb/?p=liburi-template-perl.git;a=blobdiff_plain;f=t%2Fdata%2Fspec.json;h=92979bdc94b87656c116ef02d9b7ec4f7b724a9e;hp=8705267c3d6c0d573d8993415009da3094ee2799;hb=c4fd5064ccd0e0c568bec68ebe82f3daf6c235b6;hpb=917525490f5d8e583f4b53dcd2d792b9e6f42c88 diff --git a/t/data/spec.json b/t/data/spec.json index 8705267..92979bd 100644 --- a/t/data/spec.json +++ b/t/data/spec.json @@ -1,56 +1,72 @@ { - "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:" + } + ] }