Lines Matching refs:tmpl

30 		tmpl   string
37 tmpl: "http://www.example.com/foo{?query,number}",
42 tmpl: "http://www.example.com/foo{?query,number}",
47 tmpl: "http://www.example.com/foo{?query,number}",
54 exp, _, err := Expand(tt.tmpl, tt.values)
56 t.Errorf("Expand(%q, %v) error: %v", tt.tmpl, tt.values, err)
60 t.Errorf("Expand(%q, %v)\ngot %q\nwant %q", tt.tmpl, tt.values, exp, tt.want)
82 tmpl, want string
87 {tmpl: "{var}", want: "value"},
88 {tmpl: "{hello}", want: "Hello%20World%21"},
91 {tmpl: "{+var}", want: "value"},
92 {tmpl: "{+hello}", want: "Hello%20World!"},
93 {tmpl: "{+path}/here", want: "/foo/bar/here"},
94 {tmpl: "here?ref={+path}", want: "here?ref=/foo/bar"},
95 {tmpl: "X{#var}", want: "X#value"},
96 {tmpl: "X{#hello}", want: "X#Hello%20World!"},
99 {tmpl: "map?{x,y}", want: "map?1024,768"},
100 {tmpl: "{x,hello,y}", want: "1024,Hello%20World%21,768"},
101 {tmpl: "{+x,hello,y}", want: "1024,Hello%20World!,768"},
102 {tmpl: "{+path,x}/here", want: "/foo/bar,1024/here"},
103 {tmpl: "{#x,hello,y}", want: "#1024,Hello%20World!,768"},
104 {tmpl: "{#path,x}/here", want: "#/foo/bar,1024/here"},
105 {tmpl: "X{.var}", want: "X.value"},
106 {tmpl: "X{.x,y}", want: "X.1024.768"},
107 {tmpl: "{/var}", want: "/value"},
108 {tmpl: "{/var,x}/here", want: "/value/1024/here"},
109 {tmpl: "{;x,y}", want: ";x=1024;y=768"},
110 {tmpl: "{;x,y,empty}", want: ";x=1024;y=768;empty"},
111 {tmpl: "{?x,y}", want: "?x=1024&y=768"},
112 {tmpl: "{?x,y,empty}", want: "?x=1024&y=768&empty="},
113 {tmpl: "?fixed=yes{&x}", want: "?fixed=yes&x=1024"},
114 {tmpl: "{&x,y,empty}", want: "&x=1024&y=768&empty="},
116 {tmpl: "{var:3}", want: "val"},
117 {tmpl: "{var:30}", want: "value"},
118 {tmpl: "{+path:6}/here", want: "/foo/b/here"},
119 {tmpl: "{#path:6}/here", want: "#/foo/b/here"},
120 {tmpl: "X{.var:3}", want: "X.val"},
121 {tmpl: "{/var:1,var}", want: "/v/value"},
122 {tmpl: "{;hello:5}", want: ";hello=Hello"},
123 {tmpl: "{?var:3}", want: "?var=val"},
124 {tmpl: "{&var:3}", want: "&var=val"},
127 {tmpl: "{var}", want: "value"},
128 {tmpl: "{var:20}", want: "value"},
129 {tmpl: "{var:3}", want: "val"},
130 {tmpl: "{semi}", want: "%3B"},
131 {tmpl: "{semi:2}", want: "%3B"},
133 {tmpl: "{var}", want: "value"},
134 {tmpl: "{hello}", want: "Hello%20World%21"},
135 {tmpl: "{half}", want: "50%25"},
136 {tmpl: "O{empty}X", want: "OX"},
137 {tmpl: "O{undef}X", want: "OX"},
138 {tmpl: "{x,y}", want: "1024,768"},
139 {tmpl: "{x,hello,y}", want: "1024,Hello%20World%21,768"},
140 {tmpl: "?{x,empty}", want: "?1024,"},
141 {tmpl: "?{x,undef}", want: "?1024"},
142 {tmpl: "?{undef,y}", want: "?768"},
143 {tmpl: "{var:3}", want: "val"},
144 {tmpl: "{var:30}", want: "value"},
146 {tmpl: "{+var}", want: "value"},
147 {tmpl: "{+hello}", want: "Hello%20World!"},
148 {tmpl: "{+half}", want: "50%25"},
149 {tmpl: "{base}index", want: "http%3A%2F%2Fexample.com%2Fhome%2Findex"},
150 {tmpl: "{+base}index", want: "http://example.com/home/index"},
151 {tmpl: "O{+empty}X", want: "OX"},
152 {tmpl: "O{+undef}X", want: "OX"},
153 {tmpl: "{+path}/here", want: "/foo/bar/here"},
154 {tmpl: "here?ref={+path}", want: "here?ref=/foo/bar"},
155 {tmpl: "up{+path}{var}/here", want: "up/foo/barvalue/here"},
156 {tmpl: "{+x,hello,y}", want: "1024,Hello%20World!,768"},
157 {tmpl: "{+path,x}/here", want: "/foo/bar,1024/here"},
158 {tmpl: "{+path:6}/here", want: "/foo/b/here"},
160 {tmpl: "{#var}", want: "#value"},
161 {tmpl: "{#hello}", want: "#Hello%20World!"},
162 {tmpl: "{#half}", want: "#50%25"},
163 {tmpl: "foo{#empty}", want: "foo#"},
164 {tmpl: "foo{#undef}", want: "foo"},
165 {tmpl: "{#x,hello,y}", want: "#1024,Hello%20World!,768"},
166 {tmpl: "{#path,x}/here", want: "#/foo/bar,1024/here"},
167 {tmpl: "{#path:6}/here", want: "#/foo/b/here"},
169 {tmpl: "{.who}", want: ".fred"},
170 {tmpl: "{.who,who}", want: ".fred.fred"},
171 {tmpl: "{.half,who}", want: ".50%25.fred"},
172 {tmpl: "X{.var}", want: "X.value"},
173 {tmpl: "X{.empty}", want: "X."},
174 {tmpl: "X{.undef}", want: "X"},
175 {tmpl: "X{.var:3}", want: "X.val"},
177 {tmpl: "{/who}", want: "/fred"},
178 {tmpl: "{/who,who}", want: "/fred/fred"},
179 {tmpl: "{/half,who}", want: "/50%25/fred"},
180 {tmpl: "{/who,dub}", want: "/fred/me%2Ftoo"},
181 {tmpl: "{/var}", want: "/value"},
182 {tmpl: "{/var,empty}", want: "/value/"},
183 {tmpl: "{/var,undef}", want: "/value"},
184 {tmpl: "{/var,x}/here", want: "/value/1024/here"},
185 {tmpl: "{/var:1,var}", want: "/v/value"},
187 {tmpl: "{;who}", want: ";who=fred"},
188 {tmpl: "{;half}", want: ";half=50%25"},
189 {tmpl: "{;empty}", want: ";empty"},
190 {tmpl: "{;v,empty,who}", want: ";v=6;empty;who=fred"},
191 {tmpl: "{;v,bar,who}", want: ";v=6;who=fred"},
192 {tmpl: "{;x,y}", want: ";x=1024;y=768"},
193 {tmpl: "{;x,y,empty}", want: ";x=1024;y=768;empty"},
194 {tmpl: "{;x,y,undef}", want: ";x=1024;y=768"},
195 {tmpl: "{;hello:5}", want: ";hello=Hello"},
197 {tmpl: "{?who}", want: "?who=fred"},
198 {tmpl: "{?half}", want: "?half=50%25"},
199 {tmpl: "{?x,y}", want: "?x=1024&y=768"},
200 {tmpl: "{?x,y,empty}", want: "?x=1024&y=768&empty="},
201 {tmpl: "{?x,y,undef}", want: "?x=1024&y=768"},
202 {tmpl: "{?var:3}", want: "?var=val"},
204 {tmpl: "{&who}", want: "&who=fred"},
205 {tmpl: "{&half}", want: "&half=50%25"},
206 {tmpl: "?fixed=yes{&x}", want: "?fixed=yes&x=1024"},
207 {tmpl: "{&x,y,empty}", want: "&x=1024&y=768&empty="},
208 {tmpl: "{&x,y,undef}", want: "&x=1024&y=768"},
209 {tmpl: "{&var:3}", want: "&var=val"},
212 esc, unesc, err := Expand(tt.tmpl, values)
214 t.Errorf("Expand(%q) error: %v", tt.tmpl, err)
218 t.Errorf("Expand(%q)\ngot %q\nwant %q", tt.tmpl, esc, tt.want)
223 t.Errorf("Expand(%q) gave invalid escaping %q: %v", tt.tmpl, esc, err)
227 …nsistent escaped/unescaped\nunescaped %q\nescaped %q\nwhich is %q", tt.tmpl, unesc, esc, urlUne…
234 tmpl, wantEsc, wantUnesc string
238 tmpl: "/foo/{bucket}/bar",
246 tmpl: "/foo/{bucket}/bar",
254 tmpl: "/foo/{+bucket}/bar",
262 tmpl: "/foo/{bucket}/bar",
271 esc, unesc, err := Expand(tt.tmpl, tt.values)
273 t.Errorf("Expand(%q) error: %v", tt.tmpl, err)
277 …t.Errorf("Expand(%q)\ngot esc=%q, unesc=%q\nwant esc=%q, unesc=%q", tt.tmpl, esc, unesc, tt.wantE…