@@ -14,6 +14,7 @@ import (
14
14
"math/rand"
15
15
"net/http"
16
16
"os"
17
+ "strings"
17
18
"time"
18
19
)
19
20
@@ -237,16 +238,6 @@ func (t tweet) String() string {
237
238
return fmt .Sprintf ("tweet{User:%q,Message:%q,Retweets:%d}" , t .User , t .Message , t .Retweets )
238
239
}
239
240
240
- type comment struct {
241
- User string `json:"user"`
242
- Comment string `json:"comment"`
243
- Created time.Time `json:"created,omitempty"`
244
- }
245
-
246
- func (c comment ) String () string {
247
- return fmt .Sprintf ("comment{User:%q,Comment:%q}" , c .User , c .Comment )
248
- }
249
-
250
241
type joinDoc struct {
251
242
Message string `json:"message"`
252
243
JoinField interface {} `json:"my_join_field,omitempty"`
@@ -273,11 +264,6 @@ type doctype struct {
273
264
Message string `json:"message"`
274
265
}
275
266
276
- // queries is required for Percolate tests.
277
- type queries struct {
278
- Query string `json:"query"`
279
- }
280
-
281
267
func isTravis () bool {
282
268
return os .Getenv ("TRAVIS" ) != ""
283
269
}
@@ -308,6 +294,7 @@ func (d *strictDecoder) Decode(data []byte, v interface{}) error {
308
294
309
295
var (
310
296
logDeprecations = flag .String ("deprecations" , "off" , "log or fail on deprecation warnings" )
297
+ logTypesRemoval = flag .Bool ("types-removal" , false , "log deprecation warnings regarding types removal" )
311
298
strict = flag .Bool ("strict-decoder" , false , "treat missing unknown fields in response as errors" )
312
299
)
313
300
@@ -319,7 +306,7 @@ func setupTestClient(t logger, options ...ClientOptionFunc) (client *Client) {
319
306
t .Fatal (err )
320
307
}
321
308
322
- // Add a strict decoder (unless a specific decoder has been specified already)
309
+ // Use strict JSON decoder (unless a specific decoder has been specified already)
323
310
if * strict {
324
311
if client .decoder == nil {
325
312
client .decoder = & strictDecoder {}
@@ -332,6 +319,9 @@ func setupTestClient(t logger, options ...ClientOptionFunc) (client *Client) {
332
319
if loglevel := * logDeprecations ; loglevel != "off" {
333
320
logDeprecation = func (req * http.Request , res * http.Response ) {
334
321
for _ , warning := range res .Header ["Warning" ] {
322
+ if ! * logTypesRemoval && strings .Contains (warning , "[types removal]" ) {
323
+ continue
324
+ }
335
325
switch loglevel {
336
326
default :
337
327
t .Logf ("[%s] Deprecation warning: %s" , req .URL , warning )
0 commit comments