github.com/bytedance/sonic@v1.11.7-0.20240517092252-d2edb31b167b/internal/decoder/testdata_test.go (about) 1 /* 2 * Copyright 2021 ByteDance Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package decoder 18 19 const TwitterJson = `{ 20 "statuses": [ 21 { 22 "coordinates": null, 23 "favorited": false, 24 "truncated": false, 25 "created_at": "Mon Sep 24 03:35:21 +0000 2012", 26 "id_str": "250075927172759552", 27 "entities": { 28 "urls": [ 29 30 ], 31 "hashtags": [ 32 { 33 "text": "freebandnames", 34 "indices": [ 35 20, 36 34 37 ] 38 } 39 ], 40 "user_mentions": [ 41 42 ] 43 }, 44 "in_reply_to_user_id_str": null, 45 "contributors": null, 46 "text": "Aggressive Ponytail #freebandnames", 47 "metadata": { 48 "iso_language_code": "en", 49 "result_type": "recent" 50 }, 51 "retweet_count": 0, 52 "in_reply_to_status_id_str": null, 53 "id": 250075927172759552, 54 "geo": null, 55 "retweeted": false, 56 "in_reply_to_user_id": null, 57 "place": null, 58 "user": { 59 "profile_sidebar_fill_color": "DDEEF6", 60 "profile_sidebar_border_color": "C0DEED", 61 "profile_background_tile": false, 62 "name": "Sean Cummings", 63 "profile_image_url": "https://a0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg", 64 "created_at": "Mon Apr 26 06:01:55 +0000 2010", 65 "location": "LA, CA", 66 "follow_request_sent": null, 67 "profile_link_color": "0084B4", 68 "is_translator": false, 69 "id_str": "137238150", 70 "entities": { 71 "url": { 72 "urls": [ 73 { 74 "expanded_url": null, 75 "url": "", 76 "indices": [ 77 0, 78 0 79 ] 80 } 81 ] 82 }, 83 "description": { 84 "urls": [ 85 86 ] 87 } 88 }, 89 "default_profile": true, 90 "contributors_enabled": false, 91 "favourites_count": 0, 92 "url": null, 93 "profile_image_url_https": "https://si0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg", 94 "utc_offset": -28800, 95 "id": 137238150, 96 "profile_use_background_image": true, 97 "listed_count": 2, 98 "profile_text_color": "333333", 99 "lang": "en", 100 "followers_count": 70, 101 "protected": false, 102 "notifications": null, 103 "profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme1/bg.png", 104 "profile_background_color": "C0DEED", 105 "verified": false, 106 "geo_enabled": true, 107 "time_zone": "Pacific Time (US & Canada)", 108 "description": "Born 330 Live 310", 109 "default_profile_image": false, 110 "profile_background_image_url": "https://a0.twimg.com/images/themes/theme1/bg.png", 111 "statuses_count": 579, 112 "friends_count": 110, 113 "following": null, 114 "show_all_inline_media": false, 115 "screen_name": "sean_cummings" 116 }, 117 "in_reply_to_screen_name": null, 118 "source": "<a href=\"//itunes.apple.com/us/app/twitter/id409789998?mt=12%5C%22\" rel=\"\\\"nofollow\\\"\">Twitter for Mac</a>", 119 "in_reply_to_status_id": null 120 }, 121 { 122 "coordinates": null, 123 "favorited": false, 124 "truncated": false, 125 "created_at": "Fri Sep 21 23:40:54 +0000 2012", 126 "id_str": "249292149810667520", 127 "entities": { 128 "urls": [ 129 130 ], 131 "hashtags": [ 132 { 133 "text": "FreeBandNames", 134 "indices": [ 135 20, 136 34 137 ] 138 } 139 ], 140 "user_mentions": [ 141 142 ] 143 }, 144 "in_reply_to_user_id_str": null, 145 "contributors": null, 146 "text": "Thee Namaste Nerdz. #FreeBandNames", 147 "metadata": { 148 "iso_language_code": "pl", 149 "result_type": "recent" 150 }, 151 "retweet_count": 0, 152 "in_reply_to_status_id_str": null, 153 "id": 249292149810667520, 154 "geo": null, 155 "retweeted": false, 156 "in_reply_to_user_id": null, 157 "place": null, 158 "user": { 159 "profile_sidebar_fill_color": "DDFFCC", 160 "profile_sidebar_border_color": "BDDCAD", 161 "profile_background_tile": true, 162 "name": "Chaz Martenstein", 163 "profile_image_url": "https://a0.twimg.com/profile_images/447958234/Lichtenstein_normal.jpg", 164 "created_at": "Tue Apr 07 19:05:07 +0000 2009", 165 "location": "Durham, NC", 166 "follow_request_sent": null, 167 "profile_link_color": "0084B4", 168 "is_translator": false, 169 "id_str": "29516238", 170 "entities": { 171 "url": { 172 "urls": [ 173 { 174 "expanded_url": null, 175 "url": "https://bullcityrecords.com/wnng/", 176 "indices": [ 177 0, 178 32 179 ] 180 } 181 ] 182 }, 183 "description": { 184 "urls": [ 185 186 ] 187 } 188 }, 189 "default_profile": false, 190 "contributors_enabled": false, 191 "favourites_count": 8, 192 "url": "https://bullcityrecords.com/wnng/", 193 "profile_image_url_https": "https://si0.twimg.com/profile_images/447958234/Lichtenstein_normal.jpg", 194 "utc_offset": -18000, 195 "id": 29516238, 196 "profile_use_background_image": true, 197 "listed_count": 118, 198 "profile_text_color": "333333", 199 "lang": "en", 200 "followers_count": 2052, 201 "protected": false, 202 "notifications": null, 203 "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/9423277/background_tile.bmp", 204 "profile_background_color": "9AE4E8", 205 "verified": false, 206 "geo_enabled": false, 207 "time_zone": "Eastern Time (US & Canada)", 208 "description": "You will come to Durham, North Carolina. I will sell you some records then, here in Durham, North Carolina. Fun will happen.", 209 "default_profile_image": false, 210 "profile_background_image_url": "https://a0.twimg.com/profile_background_images/9423277/background_tile.bmp", 211 "statuses_count": 7579, 212 "friends_count": 348, 213 "following": null, 214 "show_all_inline_media": true, 215 "screen_name": "bullcityrecords" 216 }, 217 "in_reply_to_screen_name": null, 218 "source": "web", 219 "in_reply_to_status_id": null 220 }, 221 { 222 "coordinates": null, 223 "favorited": false, 224 "truncated": false, 225 "created_at": "Fri Sep 21 23:30:20 +0000 2012", 226 "id_str": "249289491129438208", 227 "entities": { 228 "urls": [ 229 230 ], 231 "hashtags": [ 232 { 233 "text": "freebandnames", 234 "indices": [ 235 29, 236 43 237 ] 238 } 239 ], 240 "user_mentions": [ 241 242 ] 243 }, 244 "in_reply_to_user_id_str": null, 245 "contributors": null, 246 "text": "Mexican Heaven, Mexican Hell #freebandnames", 247 "metadata": { 248 "iso_language_code": "en", 249 "result_type": "recent" 250 }, 251 "retweet_count": 0, 252 "in_reply_to_status_id_str": null, 253 "id": 249289491129438208, 254 "geo": null, 255 "retweeted": false, 256 "in_reply_to_user_id": null, 257 "place": null, 258 "user": { 259 "profile_sidebar_fill_color": "99CC33", 260 "profile_sidebar_border_color": "829D5E", 261 "profile_background_tile": false, 262 "name": "Thomas John Wakeman", 263 "profile_image_url": "https://a0.twimg.com/profile_images/2219333930/Froggystyle_normal.png", 264 "created_at": "Tue Sep 01 21:21:35 +0000 2009", 265 "location": "Kingston New York", 266 "follow_request_sent": null, 267 "profile_link_color": "D02B55", 268 "is_translator": false, 269 "id_str": "70789458", 270 "entities": { 271 "url": { 272 "urls": [ 273 { 274 "expanded_url": null, 275 "url": "", 276 "indices": [ 277 0, 278 0 279 ] 280 } 281 ] 282 }, 283 "description": { 284 "urls": [ 285 286 ] 287 } 288 }, 289 "default_profile": false, 290 "contributors_enabled": false, 291 "favourites_count": 19, 292 "url": null, 293 "profile_image_url_https": "https://si0.twimg.com/profile_images/2219333930/Froggystyle_normal.png", 294 "utc_offset": -18000, 295 "id": 70789458, 296 "profile_use_background_image": true, 297 "listed_count": 1, 298 "profile_text_color": "3E4415", 299 "lang": "en", 300 "followers_count": 63, 301 "protected": false, 302 "notifications": null, 303 "profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme5/bg.gif", 304 "profile_background_color": "352726", 305 "verified": false, 306 "geo_enabled": false, 307 "time_zone": "Eastern Time (US & Canada)", 308 "description": "Science Fiction Writer, sort of. Likes Superheroes, Mole People, Alt. Timelines.", 309 "default_profile_image": false, 310 "profile_background_image_url": "https://a0.twimg.com/images/themes/theme5/bg.gif", 311 "statuses_count": 1048, 312 "friends_count": 63, 313 "following": null, 314 "show_all_inline_media": false, 315 "screen_name": "MonkiesFist" 316 }, 317 "in_reply_to_screen_name": null, 318 "source": "web", 319 "in_reply_to_status_id": null 320 }, 321 { 322 "coordinates": null, 323 "favorited": false, 324 "truncated": false, 325 "created_at": "Fri Sep 21 22:51:18 +0000 2012", 326 "id_str": "249279667666817024", 327 "entities": { 328 "urls": [ 329 330 ], 331 "hashtags": [ 332 { 333 "text": "freebandnames", 334 "indices": [ 335 20, 336 34 337 ] 338 } 339 ], 340 "user_mentions": [ 341 342 ] 343 }, 344 "in_reply_to_user_id_str": null, 345 "contributors": null, 346 "text": "The Foolish Mortals #freebandnames", 347 "metadata": { 348 "iso_language_code": "en", 349 "result_type": "recent" 350 }, 351 "retweet_count": 0, 352 "in_reply_to_status_id_str": null, 353 "id": 249279667666817024, 354 "geo": null, 355 "retweeted": false, 356 "in_reply_to_user_id": null, 357 "place": null, 358 "user": { 359 "profile_sidebar_fill_color": "BFAC83", 360 "profile_sidebar_border_color": "615A44", 361 "profile_background_tile": true, 362 "name": "Marty Elmer", 363 "profile_image_url": "https://a0.twimg.com/profile_images/1629790393/shrinker_2000_trans_normal.png", 364 "created_at": "Mon May 04 00:05:00 +0000 2009", 365 "location": "Wisconsin, USA", 366 "follow_request_sent": null, 367 "profile_link_color": "3B2A26", 368 "is_translator": false, 369 "id_str": "37539828", 370 "entities": { 371 "url": { 372 "urls": [ 373 { 374 "expanded_url": null, 375 "url": "https://www.omnitarian.me", 376 "indices": [ 377 0, 378 24 379 ] 380 } 381 ] 382 }, 383 "description": { 384 "urls": [ 385 386 ] 387 } 388 }, 389 "default_profile": false, 390 "contributors_enabled": false, 391 "favourites_count": 647, 392 "url": "https://www.omnitarian.me", 393 "profile_image_url_https": "https://si0.twimg.com/profile_images/1629790393/shrinker_2000_trans_normal.png", 394 "utc_offset": -21600, 395 "id": 37539828, 396 "profile_use_background_image": true, 397 "listed_count": 52, 398 "profile_text_color": "000000", 399 "lang": "en", 400 "followers_count": 608, 401 "protected": false, 402 "notifications": null, 403 "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/106455659/rect6056-9.png", 404 "profile_background_color": "EEE3C4", 405 "verified": false, 406 "geo_enabled": false, 407 "time_zone": "Central Time (US & Canada)", 408 "description": "Cartoonist, Illustrator, and T-Shirt connoisseur", 409 "default_profile_image": false, 410 "profile_background_image_url": "https://a0.twimg.com/profile_background_images/106455659/rect6056-9.png", 411 "statuses_count": 3575, 412 "friends_count": 249, 413 "following": null, 414 "show_all_inline_media": true, 415 "screen_name": "Omnitarian" 416 }, 417 "in_reply_to_screen_name": null, 418 "source": "<a href=\"//twitter.com/download/iphone%5C%22\" rel=\"\\\"nofollow\\\"\">Twitter for iPhone</a>", 419 "in_reply_to_status_id": null 420 } 421 ], 422 "search_metadata": { 423 "max_id": 250126199840518145, 424 "since_id": 24012619984051000, 425 "refresh_url": "?since_id=250126199840518145&q=%23freebandnames&result_type=mixed&include_entities=1", 426 "next_results": "?max_id=249279667666817023&q=%23freebandnames&count=4&include_entities=1&result_type=mixed", 427 "count": 4, 428 "completed_in": 0.035, 429 "since_id_str": "24012619984051000", 430 "query": "%23freebandnames", 431 "max_id_str": "250126199840518145" 432 } 433 }` 434 435 type TwitterStruct struct { 436 Statuses []Statuses `json:"statuses"` 437 SearchMetadata SearchMetadata `json:"search_metadata"` 438 } 439 440 type Hashtags struct { 441 Text string `json:"text"` 442 Indices []int `json:"indices"` 443 } 444 445 type Entities struct { 446 Urls []interface{} `json:"urls"` 447 Hashtags []Hashtags `json:"hashtags"` 448 UserMentions []interface{} `json:"user_mentions"` 449 } 450 451 type Metadata struct { 452 IsoLanguageCode string `json:"iso_language_code"` 453 ResultType string `json:"result_type"` 454 } 455 456 type Urls struct { 457 ExpandedURL interface{} `json:"expanded_url"` 458 URL string `json:"url"` 459 Indices []int `json:"indices"` 460 } 461 462 type URL struct { 463 Urls []Urls `json:"urls"` 464 } 465 466 type Description struct { 467 Urls []interface{} `json:"urls"` 468 } 469 470 type UserEntities struct { 471 URL URL `json:"url"` 472 Description Description `json:"description"` 473 } 474 475 type User struct { 476 ProfileSidebarFillColor string `json:"profile_sidebar_fill_color"` 477 ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"` 478 ProfileBackgroundTile bool `json:"profile_background_tile"` 479 Name string `json:"name"` 480 ProfileImageURL string `json:"profile_image_url"` 481 CreatedAt string `json:"created_at"` 482 Location string `json:"location"` 483 FollowRequestSent interface{} `json:"follow_request_sent"` 484 ProfileLinkColor string `json:"profile_link_color"` 485 IsTranslator bool `json:"is_translator"` 486 IDStr string `json:"id_str"` 487 Entities UserEntities `json:"entities"` 488 DefaultProfile bool `json:"default_profile"` 489 ContributorsEnabled bool `json:"contributors_enabled"` 490 FavouritesCount int `json:"favourites_count"` 491 URL interface{} `json:"url"` 492 ProfileImageURLHTTPS string `json:"profile_image_url_https"` 493 UtcOffset int `json:"utc_offset"` 494 ID int `json:"id"` 495 ProfileUseBackgroundImage bool `json:"profile_use_background_image"` 496 ListedCount int `json:"listed_count"` 497 ProfileTextColor string `json:"profile_text_color"` 498 Lang string `json:"lang"` 499 FollowersCount int `json:"followers_count"` 500 Protected bool `json:"protected"` 501 Notifications interface{} `json:"notifications"` 502 ProfileBackgroundImageURLHTTPS string `json:"profile_background_image_url_https"` 503 ProfileBackgroundColor string `json:"profile_background_color"` 504 Verified bool `json:"verified"` 505 GeoEnabled bool `json:"geo_enabled"` 506 TimeZone string `json:"time_zone"` 507 Description string `json:"description"` 508 DefaultProfileImage bool `json:"default_profile_image"` 509 ProfileBackgroundImageURL string `json:"profile_background_image_url"` 510 StatusesCount int `json:"statuses_count"` 511 FriendsCount int `json:"friends_count"` 512 Following interface{} `json:"following"` 513 ShowAllInlineMedia bool `json:"show_all_inline_media"` 514 ScreenName string `json:"screen_name"` 515 } 516 517 type Statuses struct { 518 Coordinates interface{} `json:"coordinates"` 519 Favorited bool `json:"favorited"` 520 Truncated bool `json:"truncated"` 521 CreatedAt string `json:"created_at"` 522 IDStr string `json:"id_str"` 523 Entities Entities `json:"entities"` 524 InReplyToUserIDStr interface{} `json:"in_reply_to_user_id_str"` 525 Contributors interface{} `json:"contributors"` 526 Text string `json:"text"` 527 Metadata Metadata `json:"metadata"` 528 RetweetCount int `json:"retweet_count"` 529 InReplyToStatusIDStr interface{} `json:"in_reply_to_status_id_str"` 530 ID int64 `json:"id"` 531 Geo interface{} `json:"geo"` 532 Retweeted bool `json:"retweeted"` 533 InReplyToUserID interface{} `json:"in_reply_to_user_id"` 534 Place interface{} `json:"place"` 535 User User `json:"user"` 536 InReplyToScreenName interface{} `json:"in_reply_to_screen_name"` 537 Source string `json:"source"` 538 InReplyToStatusID interface{} `json:"in_reply_to_status_id"` 539 } 540 541 type SearchMetadata struct { 542 MaxID int64 `json:"max_id"` 543 SinceID int64 `json:"since_id"` 544 RefreshURL string `json:"refresh_url"` 545 NextResults string `json:"next_results"` 546 Count int `json:"count"` 547 CompletedIn float64 `json:"completed_in"` 548 SinceIDStr string `json:"since_id_str"` 549 Query string `json:"query"` 550 MaxIDStr string `json:"max_id_str"` 551 }